From 163ae61e16a376c336edb16ddce4adc4301d6751 Mon Sep 17 00:00:00 2001 From: Alexander Lampret Date: Mon, 5 Mar 2018 22:26:09 +0100 Subject: [PATCH 01/11] captcha possible for login form --- src/ZfcUser/Form/Login.php | 28 ++++++++++++----- .../AuthenticationOptionsInterface.php | 30 +++++++++++++++++++ src/ZfcUser/Options/ModuleOptions.php | 27 +++++++++++++++++ 3 files changed, 77 insertions(+), 8 deletions(-) diff --git a/src/ZfcUser/Form/Login.php b/src/ZfcUser/Form/Login.php index 46966778..517f8854 100644 --- a/src/ZfcUser/Form/Login.php +++ b/src/ZfcUser/Form/Login.php @@ -47,14 +47,26 @@ public function __construct($name, AuthenticationOptionsInterface $options) ), )); - // @todo: Fix this - // 1) getValidator() is a protected method - // 2) i don't believe the login form is actually being validated by the login action - // (but keep in mind we don't want to show invalid username vs invalid password or - // anything like that, it should just say "login failed" without any additional info) - //$csrf = new Element\Csrf('csrf'); - //$csrf->getValidator()->setTimeout($options->getLoginFormTimeout()); - //$this->add($csrf); + $this->add([ + 'type' => '\Zend\Form\Element\Csrf', + 'name' => 'security', + 'options' => [ + 'csrf_options' => [ + 'timeout' => $this->getAuthenticationOptions()->getLoginFormTimeout() + ] + ] + ]); + + if ($this->getAuthenticationOptions()->getUseLoginFormCaptcha()) { + $this->add(array( + 'name' => 'captcha', + 'type' => 'Zend\Form\Element\Captcha', + 'options' => array( + 'label' => 'Human check', + 'captcha' => $this->getAuthenticationOptions()->getFormCaptchaOptions(), + ), + )); + } $submitElement = new Element\Button('submit'); $submitElement diff --git a/src/ZfcUser/Options/AuthenticationOptionsInterface.php b/src/ZfcUser/Options/AuthenticationOptionsInterface.php index 9a35d875..bdaf133f 100644 --- a/src/ZfcUser/Options/AuthenticationOptionsInterface.php +++ b/src/ZfcUser/Options/AuthenticationOptionsInterface.php @@ -33,4 +33,34 @@ public function setAuthIdentityFields($authIdentityFields); * @return array */ public function getAuthIdentityFields(); + + /** + * set use a captcha in registration form + * + * @param bool $useRegistrationFormCaptcha + * @return ModuleOptions + */ + public function setUseLoginFormCaptcha($useRegistrationFormCaptcha); + + /** + * get use a captcha in registration form + * + * @return bool + */ + public function getUseLoginFormCaptcha(); + + /** + * set form CAPTCHA options + * + * @param array $formCaptchaOptions + * @return ModuleOptions + */ + public function setFormCaptchaOptions($formCaptchaOptions); + + /** + * get form CAPTCHA options + * + * @return array + */ + public function getFormCaptchaOptions(); } diff --git a/src/ZfcUser/Options/ModuleOptions.php b/src/ZfcUser/Options/ModuleOptions.php index 698b6a77..108b8c80 100644 --- a/src/ZfcUser/Options/ModuleOptions.php +++ b/src/ZfcUser/Options/ModuleOptions.php @@ -97,6 +97,11 @@ class ModuleOptions extends AbstractOptions implements * @var bool */ protected $useRegistrationFormCaptcha = false; + + /** + * @var bool + */ + protected $useLoginFormCaptcha = false; /** * @var int @@ -472,6 +477,28 @@ public function getUseRegistrationFormCaptcha() { return $this->useRegistrationFormCaptcha; } + + /** + * set use a captcha in login form + * + * @param bool $useRegistrationFormCaptcha + * @return ModuleOptions + */ + public function setUseLoginFormCaptcha($useLoginFormCaptcha) + { + $this->useLoginFormCaptcha = $useLoginFormCaptcha; + return $this; + } + + /** + * get use a captcha in login form + * + * @return bool + */ + public function getUseLoginFormCaptcha() + { + return $this->useLoginFormCaptcha; + } /** * set user entity class name From eeb259b22ae2701be5814b9c7f8355ad88b81d04 Mon Sep 17 00:00:00 2001 From: Alex Lampret Date: Mon, 23 Jul 2018 13:20:41 +0200 Subject: [PATCH 02/11] Update LoginFilter.php --- src/ZfcUser/Form/LoginFilter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ZfcUser/Form/LoginFilter.php b/src/ZfcUser/Form/LoginFilter.php index 3f98e3e6..83a50cd7 100644 --- a/src/ZfcUser/Form/LoginFilter.php +++ b/src/ZfcUser/Form/LoginFilter.php @@ -12,7 +12,10 @@ public function __construct(AuthenticationOptionsInterface $options) $identityParams = array( 'name' => 'identity', 'required' => true, - 'validators' => array() + 'validators' => array(), + 'filters' => array( + array('name' => 'StringTrim'), + ), ); $identityFields = $options->getAuthIdentityFields(); From d0e525cf06100356258ed7fdc7a146bcd856b954 Mon Sep 17 00:00:00 2001 From: Alexander Lampret Date: Sat, 20 Apr 2019 18:37:30 +0200 Subject: [PATCH 03/11] update default config --- config/zfcuser.global.php.dist | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/zfcuser.global.php.dist b/config/zfcuser.global.php.dist index c7b53f35..130e19a0 100644 --- a/config/zfcuser.global.php.dist +++ b/config/zfcuser.global.php.dist @@ -111,6 +111,14 @@ $settings = array( */ //'use_registration_form_captcha' => false, + /** + * Login Form Captcha + * + * Determines if a captcha should be utilized on the user login form. + * Default value is false. + */ + //'use_login_form_captcha' => false, + /** * Form Captcha Options * From 3c0179a3b8571b198336f0453e951f13a2e88909 Mon Sep 17 00:00:00 2001 From: "Lampret, Alexander" Date: Thu, 2 Apr 2020 16:25:10 +0200 Subject: [PATCH 04/11] dynamic csrf in login form --- src/ZfcUser/Form/Login.php | 19 ++++++------- .../AuthenticationOptionsInterface.php | 15 +++++++++++ src/ZfcUser/Options/ModuleOptions.php | 27 +++++++++++++++++++ 3 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/ZfcUser/Form/Login.php b/src/ZfcUser/Form/Login.php index c487be1d..50f4ce4d 100644 --- a/src/ZfcUser/Form/Login.php +++ b/src/ZfcUser/Form/Login.php @@ -47,16 +47,17 @@ public function __construct($name, AuthenticationOptionsInterface $options) ), )); - $this->add([ - 'type' => '\Zend\Form\Element\Csrf', - 'name' => 'security', - 'options' => [ - 'csrf_options' => [ - 'timeout' => $this->getAuthenticationOptions()->getLoginFormTimeout() + if ($this->getAuthenticationOptions()->getUseLoginFormCsrf()) { + $this->add([ + 'type' => '\Zend\Form\Element\Csrf', + 'name' => 'security', + 'options' => [ + 'csrf_options' => [ + 'timeout' => $this->getAuthenticationOptions()->getLoginFormTimeout() + ] ] - ] - ]); - + ]); + } if ($this->getAuthenticationOptions()->getUseLoginFormCaptcha()) { $this->add(array( 'name' => 'captcha', diff --git a/src/ZfcUser/Options/AuthenticationOptionsInterface.php b/src/ZfcUser/Options/AuthenticationOptionsInterface.php index bdaf133f..5c0a6b7d 100644 --- a/src/ZfcUser/Options/AuthenticationOptionsInterface.php +++ b/src/ZfcUser/Options/AuthenticationOptionsInterface.php @@ -49,6 +49,21 @@ public function setUseLoginFormCaptcha($useRegistrationFormCaptcha); */ public function getUseLoginFormCaptcha(); + /** + * set use a csrf in login form + * + * @param bool $useRegistrationFormCaptcha + * @return ModuleOptions + */ + public function setUseLoginFormCsrf($useLoginFormCsrf); + + /** + * get use a csrf in login form + * + * @return bool + */ + public function getUseLoginFormCsrf(); + /** * set form CAPTCHA options * diff --git a/src/ZfcUser/Options/ModuleOptions.php b/src/ZfcUser/Options/ModuleOptions.php index 108b8c80..59d47f19 100644 --- a/src/ZfcUser/Options/ModuleOptions.php +++ b/src/ZfcUser/Options/ModuleOptions.php @@ -102,6 +102,11 @@ class ModuleOptions extends AbstractOptions implements * @var bool */ protected $useLoginFormCaptcha = false; + + /** + * @var bool + */ + protected $useLoginFormCsrf = true; /** * @var int @@ -499,6 +504,28 @@ public function getUseLoginFormCaptcha() { return $this->useLoginFormCaptcha; } + + /** + * set use a csrf in login form + * + * @param bool $useRegistrationFormCaptcha + * @return ModuleOptions + */ + public function setUseLoginFormCsrf($useLoginFormCsrf) + { + $this->useLoginFormCsrf = $useLoginFormCsrf; + return $this; + } + + /** + * get use a csrf in login form + * + * @return bool + */ + public function getUseLoginFormCsrf() + { + return $this->useLoginFormCsrf; + } /** * set user entity class name From dcef6c459f647150fa968f241b68580e58ca83c3 Mon Sep 17 00:00:00 2001 From: Alex Lampret Date: Mon, 24 Aug 2020 11:34:25 +0200 Subject: [PATCH 05/11] Update composer.json --- composer.json | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 20d18582..ca1117f3 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "zf-commons/zfc-user", + "name": "lampi87/zfc-user", "description": "A generic user registration and authentication module for ZF2. Supports Zend\\Db and Doctrine2.", "type": "library", "license": "BSD-3-Clause", @@ -25,34 +25,34 @@ } }, "require": { - "php": "^5.5|^7.0", - "zendframework/zend-authentication": "^2.5", - "zendframework/zend-crypt": "^3.0", - "zendframework/zend-form": "^2.9", - "zendframework/zend-inputfilter": "^2.7", - "zendframework/zend-loader": "^2.5", - "zendframework/zend-modulemanager": "^2.7", - "zendframework/zend-mvc": "^3.0", - "zendframework/zend-servicemanager": "^3.0", - "zendframework/zend-stdlib": "^3.0", - "zendframework/zend-validator": "^2.8", - "zendframework/zend-db": "^2.8", - "zendframework/zend-view": "^2.8", - "zendframework/zend-session" : "^2.7", - "zendframework/zend-http" : "^2.5", - "zendframework/zend-mvc-plugin-flashmessenger": "^1.0", - "zendframework/zend-i18n": "^2.7", - "zendframework/zend-mvc-plugin-prg": "^1.0", - "zendframework/zend-hydrator": "^2.0" + "php": "^7.0", + "laminas/laminas-authentication": "^2.5", + "laminas/laminas-crypt": "^3.0", + "laminas/laminas-form": "^2.9", + "laminas/laminas-inputfilter": "^2.7", + "laminas/laminas-loader": "^2.5", + "laminas/laminas-modulemanager": "^2.7", + "laminas/laminas-mvc": "^3.0", + "laminas/laminas-servicemanager": "^3.0", + "laminas/laminas-stdlib": "^3.0", + "laminas/laminas-validator": "^2.8", + "laminas/laminas-db": "^2.8", + "laminas/laminas-view": "^2.8", + "laminas/laminas-session" : "^2.7", + "laminas/laminas-http" : "^2.5", + "laminas/laminas-mvc-plugin-flashmessenger": "^1.0", + "laminas/laminas-i18n": "^2.7", + "laminas/laminas-mvc-plugin-prg": "^1.0", + "laminas/laminas-hydrator": "^2.0" }, "require-dev" : { - "phpunit/phpunit" : ">=3.7,<4", - "phpmd/phpmd" : "1.4.*", - "squizlabs/php_codesniffer" : "1.4.*", - "zendframework/zend-captcha" : "^2.6" + "phpunit/phpunit" : "*", + "phpmd/phpmd" : "*", + "squizlabs/php_codesniffer" : "*", + "laminas/laminas-captcha" : "^2.6" }, "suggest": { - "zendframework/zend-captcha" : "Zend\\Captcha if you want to use the captcha component" + "laminas/laminas-captcha" : "Zend\\Captcha if you want to use the captcha component" }, "autoload": { "psr-0": { From e4a1bc586c03e3f0dae1b18a66b8556f0d1aef43 Mon Sep 17 00:00:00 2001 From: Alex Lampret Date: Wed, 26 Aug 2020 16:38:43 +0200 Subject: [PATCH 06/11] Update AbstractAdapter.php --- src/ZfcUser/Authentication/Adapter/AbstractAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZfcUser/Authentication/Adapter/AbstractAdapter.php b/src/ZfcUser/Authentication/Adapter/AbstractAdapter.php index a47d9a32..aa41f746 100644 --- a/src/ZfcUser/Authentication/Adapter/AbstractAdapter.php +++ b/src/ZfcUser/Authentication/Adapter/AbstractAdapter.php @@ -21,7 +21,7 @@ abstract class AbstractAdapter implements ChainableAdapter public function getStorage() { if (null === $this->storage) { - $this->setStorage(new Storage\Session(get_class($this))); + $this->setStorage(new Storage\Session('ZfcUser')); } return $this->storage; From cd268ce0fb561e95298bc68991eeedbb959c373c Mon Sep 17 00:00:00 2001 From: Alex Lampret Date: Wed, 26 Aug 2020 16:39:27 +0200 Subject: [PATCH 07/11] Update Db.php --- src/ZfcUser/Authentication/Adapter/Db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZfcUser/Authentication/Adapter/Db.php b/src/ZfcUser/Authentication/Adapter/Db.php index b6187464..f8364b0d 100644 --- a/src/ZfcUser/Authentication/Adapter/Db.php +++ b/src/ZfcUser/Authentication/Adapter/Db.php @@ -105,7 +105,7 @@ public function authenticate(AdapterChainEvent $e) } // regen the id - $session = new SessionContainer($this->getStorage()->getNameSpace()); + $session = new SessionContainer('ZfcUser'); $session->getManager()->regenerateId(); // Success! From fb86163fa5eba929a4541785feaed0a2a106307f Mon Sep 17 00:00:00 2001 From: Alex Lampret Date: Tue, 1 Sep 2020 11:02:33 +0200 Subject: [PATCH 08/11] Update UserInterface.php --- src/ZfcUser/Entity/UserInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ZfcUser/Entity/UserInterface.php b/src/ZfcUser/Entity/UserInterface.php index 75d61289..88e23168 100644 --- a/src/ZfcUser/Entity/UserInterface.php +++ b/src/ZfcUser/Entity/UserInterface.php @@ -82,14 +82,14 @@ public function setPassword($password); /** * Get state. * - * @return int + * @return boolean */ public function getState(); /** * Set state. * - * @param int $state + * @param boolean $state * @return UserInterface */ public function setState($state); From baeb5f103d8f9ea1e47b8f67ebab619ca9b02098 Mon Sep 17 00:00:00 2001 From: Alex Lampret Date: Tue, 1 Sep 2020 11:18:33 +0200 Subject: [PATCH 09/11] Update UserInterface.php --- src/ZfcUser/Entity/UserInterface.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ZfcUser/Entity/UserInterface.php b/src/ZfcUser/Entity/UserInterface.php index 88e23168..2fbe1cd1 100644 --- a/src/ZfcUser/Entity/UserInterface.php +++ b/src/ZfcUser/Entity/UserInterface.php @@ -90,7 +90,6 @@ public function getState(); * Set state. * * @param boolean $state - * @return UserInterface */ public function setState($state); } From 084c23c9e9c8de0572be1571473ab3aa6dc18061 Mon Sep 17 00:00:00 2001 From: Alexander Lampret Date: Sun, 27 Sep 2020 19:11:29 +0200 Subject: [PATCH 10/11] rename zend to laminas --- Module.php | 16 +-- README.md | 24 ++-- composer.json | 4 +- config/zfcuser.global.php.dist | 10 +- .../Adapter/AbstractAdapter.php | 2 +- .../Authentication/Adapter/AdapterChain.php | 14 +-- .../Adapter/AdapterChainEvent.php | 4 +- .../Adapter/AdapterChainServiceFactory.php | 8 +- .../Adapter/ChainableAdapter.php | 4 +- src/ZfcUser/Authentication/Adapter/Db.php | 10 +- .../Exception/OptionsNotFoundException.php | 2 +- src/ZfcUser/Authentication/Storage/Db.php | 14 +-- .../Plugin/ZfcUserAuthentication.php | 6 +- src/ZfcUser/Controller/RedirectCallback.php | 8 +- src/ZfcUser/Controller/UserController.php | 12 +- src/ZfcUser/Db/Adapter/MasterSlaveAdapter.php | 6 +- .../Adapter/MasterSlaveAdapterInterface.php | 2 +- src/ZfcUser/EventManager/EventProvider.php | 8 +- .../Authentication/Adapter/DbFactory.php | 4 +- .../Authentication/Storage/DbFactory.php | 4 +- src/ZfcUser/Factory/AuthenticationService.php | 6 +- .../Plugin/ZfcUserAuthentication.php | 4 +- .../Controller/RedirectCallbackFactory.php | 8 +- .../Controller/UserControllerFactory.php | 6 +- src/ZfcUser/Factory/Form/ChangeEmail.php | 2 +- src/ZfcUser/Factory/Form/ChangePassword.php | 2 +- src/ZfcUser/Factory/Form/Login.php | 2 +- src/ZfcUser/Factory/Form/Register.php | 2 +- src/ZfcUser/Factory/Mapper/User.php | 4 +- src/ZfcUser/Factory/Options/ModuleOptions.php | 4 +- src/ZfcUser/Factory/Service/UserFactory.php | 4 +- src/ZfcUser/Factory/UserHydrator.php | 6 +- .../View/Helper/ZfcUserDisplayName.php | 2 +- .../Factory/View/Helper/ZfcUserIdentity.php | 2 +- .../View/Helper/ZfcUserLoginWidget.php | 2 +- src/ZfcUser/Form/Base.php | 4 +- src/ZfcUser/Form/ChangeEmailFilter.php | 2 +- src/ZfcUser/Form/ChangePasswordFilter.php | 2 +- src/ZfcUser/Form/Login.php | 6 +- src/ZfcUser/Form/ProvidesEventsForm.php | 4 +- src/ZfcUser/Form/Register.php | 4 +- .../InputFilter/ProvidesEventsInputFilter.php | 4 +- src/ZfcUser/Mapper/AbstractDbMapper.php | 16 +-- src/ZfcUser/Mapper/User.php | 2 +- src/ZfcUser/Mapper/UserHydrator.php | 2 +- src/ZfcUser/Options/ModuleOptions.php | 2 +- src/ZfcUser/Service/User.php | 12 +- src/ZfcUser/Validator/AbstractRecord.php | 2 +- .../View/Helper/ZfcUserDisplayName.php | 4 +- src/ZfcUser/View/Helper/ZfcUserIdentity.php | 4 +- .../View/Helper/ZfcUserLoginWidget.php | 4 +- .../Adapter/AbstractAdapterTest.php | 6 +- .../Adapter/AdapterChainEventTest.php | 4 +- .../AdapterChainServiceFactoryTest.php | 8 +- .../Adapter/AdapterChainTest.php | 24 ++-- .../Authentication/Adapter/DbTest.php | 38 +++---- .../TestAsset/AbstractAdapterExtension.php | 2 +- .../Authentication/Storage/DbTest.php | 14 +-- .../Plugin/ZfcUserAuthenticationTest.php | 14 +-- .../Controller/RedirectCallbackTest.php | 38 +++---- .../Controller/UserControllerTest.php | 104 +++++++++--------- .../Form/ChangeEmailFormFactoryTest.php | 4 +- .../Form/ChangePasswordFormFactoryTest.php | 4 +- .../Factory/Form/LoginFormFactoryTest.php | 4 +- .../Factory/Form/RegisterFormFactoryTest.php | 6 +- .../Form/ChangeEmailFilterTest.php | 4 +- .../Form/ChangePasswordFilterTest.php | 4 +- tests/ZfcUserTest/Form/LoginFilterTest.php | 2 +- tests/ZfcUserTest/Form/RegisterTest.php | 6 +- tests/ZfcUserTest/Mapper/UserTest.php | 34 +++--- tests/ZfcUserTest/Service/UserTest.php | 14 +-- .../View/Helper/ZfcUserDisplayNameTest.php | 2 +- .../View/Helper/ZfcUserIdentityTest.php | 2 +- .../View/Helper/ZfcUserLoginWidgetTest.php | 12 +- view/zfc-user/user/_form.phtml | 2 +- 75 files changed, 322 insertions(+), 322 deletions(-) diff --git a/Module.php b/Module.php index 7e2263d6..ff770141 100644 --- a/Module.php +++ b/Module.php @@ -2,10 +2,10 @@ namespace ZfcUser; -use Zend\ModuleManager\Feature\ConfigProviderInterface; -use Zend\ModuleManager\Feature\ControllerPluginProviderInterface; -use Zend\ModuleManager\Feature\ControllerProviderInterface; -use Zend\ModuleManager\Feature\ServiceProviderInterface; +use Laminas\ModuleManager\Feature\ConfigProviderInterface; +use Laminas\ModuleManager\Feature\ControllerPluginProviderInterface; +use Laminas\ModuleManager\Feature\ControllerProviderInterface; +use Laminas\ModuleManager\Feature\ServiceProviderInterface; class Module implements ControllerProviderInterface, @@ -52,10 +52,10 @@ public function getServiceConfig() { return array( 'aliases' => array( - 'zfcuser_zend_db_adapter' => \Zend\Db\Adapter\Adapter::class, + 'zfcuser_zend_db_adapter' => \Laminas\Db\Adapter\Adapter::class, ), 'invokables' => array( - 'zfcuser_register_form_hydrator' => \Zend\Hydrator\ClassMethods::class, + 'zfcuser_register_form_hydrator' => \Laminas\Hydrator\ClassMethods::class, ), 'factories' => array( 'zfcuser_redirect_callback' => \ZfcUser\Factory\Controller\RedirectCallbackFactory::class, @@ -63,8 +63,8 @@ public function getServiceConfig() 'ZfcUser\Authentication\Adapter\AdapterChain' => \ZfcUser\Authentication\Adapter\AdapterChainServiceFactory::class, // We alias this one because it's ZfcUser's instance of - // Zend\Authentication\AuthenticationService. We don't want to - // hog the FQCN service alias for a Zend\* class. + // Laminas\Authentication\AuthenticationService. We don't want to + // hog the FQCN service alias for a Laminas\* class. 'zfcuser_auth_service' => \ZfcUser\Factory\AuthenticationService::class, 'zfcuser_user_hydrator' => \ZfcUser\Factory\UserHydrator::class, diff --git a/README.md b/README.md index 9790901f..b8dfb634 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Created by Evan Coury and the ZF-Commons team Introduction ------------ -ZfcUser is a user registration and authentication module for Zend Framework 2. -Out of the box, ZfcUser works with Zend\Db, however alternative storage adapter +ZfcUser is a user registration and authentication module for Laminas Framework 2. +Out of the box, ZfcUser works with Laminas\Db, however alternative storage adapter modules are available (see below). ZfcUser provides the foundations for adding user authentication and registration to your ZF2 site. It is designed to be very simple and easy to extend. @@ -22,7 +22,7 @@ Versions -------- Please use below table to figure out what version of ZfcUser you should use. -| ZfcUser version | Supported Zend Framework version | Status | +| ZfcUser version | Supported Laminas Framework version | Status | |-----------------|----------------------------------|---------------------------------------------| | 1.x | <= 2.5 | Security-fixes only | | 2.x | >= 2.6 < 3 | bug-fixes, security-fixes | @@ -31,7 +31,7 @@ Please use below table to figure out what version of ZfcUser you should use. Storage Adapter Modules ----------------------- -By default, ZfcUser ships with support for using Zend\Db for persisting users. +By default, ZfcUser ships with support for using Laminas\Db for persisting users. However, by installing an optional alternative storage adapter module, you can take advantage of other methods of persisting users: @@ -41,7 +41,7 @@ take advantage of other methods of persisting users: Requirements ------------ -* [Zend Framework 2](https://github.com/zendframework/zf2) (latest master) +* [Laminas Framework](https://github.com/zendframework/zf2) (latest master) * [ZfcBase](https://github.com/ZF-Commons/ZfcBase) (latest master). Features / Goals @@ -51,7 +51,7 @@ Features / Goals username and use strictly email) [COMPLETE] * User registration [COMPLETE] * Forms protected against CSRF [COMPLETE] -* Out-of-the-box support for Doctrine2 _and_ Zend\Db [COMPLETE] +* Out-of-the-box support for Doctrine2 _and_ Laminas\Db [COMPLETE] * Robust event system to allow for extending [COMPLETE] * Provide ActionController plugin and view helper [COMPLETE] @@ -107,9 +107,9 @@ Coming soon... Coming soon... -### Post-Install: Zend\Db +### Post-Install: Laminas\Db -1. If you do not already have a valid Zend\Db\Adapter\Adapter in your service +1. If you do not already have a valid Laminas\Db\Adapter\Adapter in your service manager configuration, put the following in `./config/autoload/database.local.php`: ```php @@ -124,7 +124,7 @@ return array( ), 'service_manager' => array( 'factories' => array( - 'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory', + 'Laminas\Db\Adapter\Adapter' => 'Laminas\Db\Adapter\AdapterServiceFactory', ), ), ); @@ -183,8 +183,8 @@ The following options are available: after they successfully register. Default value is `false`. - **use_registration_form_captcha** - Boolean value, determines if a captcha should be utilized on the user registration form. Default value is `true`. (Note, - right now this only utilizes a weak Zend\Text\Figlet CAPTCHA, but I have plans - to make all Zend\Captcha adapters work.) + right now this only utilizes a weak Laminas\Text\Figlet CAPTCHA, but I have plans + to make all Laminas\Captcha adapters work.) - **login_form_timeout** - Integer value, specify the timeout for the CSRF security field of the login form in seconds. Default value is 300 seconds. - **user_form_timeout** - Integer value, specify the timeout for the CSRF security @@ -226,7 +226,7 @@ module.config.php, or a dedicated recaptcha.config.php): 'instance'=>array( 'alias'=>array( // OTHER ELEMENTS.... - 'recaptcha_element' => 'Zend\Form\Element\Captcha', + 'recaptcha_element' => 'Laminas\Form\Element\Captcha', ), 'recaptcha_element' => array( 'parameters' => array( diff --git a/composer.json b/composer.json index ca1117f3..379a3d0d 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "lampi87/zfc-user", - "description": "A generic user registration and authentication module for ZF2. Supports Zend\\Db and Doctrine2.", + "description": "A generic user registration and authentication module for ZF2. Supports Laminas\\Db and Doctrine2.", "type": "library", "license": "BSD-3-Clause", "keywords": [ @@ -52,7 +52,7 @@ "laminas/laminas-captcha" : "^2.6" }, "suggest": { - "laminas/laminas-captcha" : "Zend\\Captcha if you want to use the captcha component" + "laminas/laminas-captcha" : "Laminas\\Captcha if you want to use the captcha component" }, "autoload": { "psr-0": { diff --git a/config/zfcuser.global.php.dist b/config/zfcuser.global.php.dist index 130e19a0..d29c8481 100644 --- a/config/zfcuser.global.php.dist +++ b/config/zfcuser.global.php.dist @@ -7,12 +7,12 @@ */ $settings = array( /** - * Zend\Db\Adapter\Adapter DI Alias + * Laminas\Db\Adapter\Adapter DI Alias * - * Please specify the DI alias for the configured Zend\Db\Adapter\Adapter + * Please specify the DI alias for the configured Laminas\Db\Adapter\Adapter * instance that ZfcUser should use. */ - //'zend_db_adapter' => 'Zend\Db\Adapter\Adapter', + //'zend_db_adapter' => 'Laminas\Db\Adapter\Adapter', /** * User Model Entity Class @@ -123,7 +123,7 @@ $settings = array( * Form Captcha Options * * Currently used for the registration form, but re-usable anywhere. Use - * this to configure which Zend\Captcha adapter to use, and the options to + * this to configure which Laminas\Captcha adapter to use, and the options to * pass to it. The default uses the Figlet captcha. */ /*'form_captcha_options' => array( @@ -237,7 +237,7 @@ return array( 'zfcuser' => $settings, 'service_manager' => array( 'aliases' => array( - 'zfcuser_zend_db_adapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Zend\Db\Adapter\Adapter', + 'zfcuser_zend_db_adapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Laminas\Db\Adapter\Adapter', ), ), ); diff --git a/src/ZfcUser/Authentication/Adapter/AbstractAdapter.php b/src/ZfcUser/Authentication/Adapter/AbstractAdapter.php index aa41f746..8d63fe49 100644 --- a/src/ZfcUser/Authentication/Adapter/AbstractAdapter.php +++ b/src/ZfcUser/Authentication/Adapter/AbstractAdapter.php @@ -2,7 +2,7 @@ namespace ZfcUser\Authentication\Adapter; -use Zend\Authentication\Storage; +use Laminas\Authentication\Storage; abstract class AbstractAdapter implements ChainableAdapter { diff --git a/src/ZfcUser/Authentication/Adapter/AdapterChain.php b/src/ZfcUser/Authentication/Adapter/AdapterChain.php index b15857ed..eef423fd 100644 --- a/src/ZfcUser/Authentication/Adapter/AdapterChain.php +++ b/src/ZfcUser/Authentication/Adapter/AdapterChain.php @@ -2,13 +2,13 @@ namespace ZfcUser\Authentication\Adapter; -use Zend\Authentication\Adapter\AdapterInterface; -use Zend\Authentication\Result as AuthenticationResult; -use Zend\EventManager\Event; -use Zend\EventManager\EventInterface; -use Zend\EventManager\EventManagerAwareTrait; -use Zend\Stdlib\RequestInterface as Request; -use Zend\Stdlib\ResponseInterface as Response; +use Laminas\Authentication\Adapter\AdapterInterface; +use Laminas\Authentication\Result as AuthenticationResult; +use Laminas\EventManager\Event; +use Laminas\EventManager\EventInterface; +use Laminas\EventManager\EventManagerAwareTrait; +use Laminas\Stdlib\RequestInterface as Request; +use Laminas\Stdlib\ResponseInterface as Response; use ZfcUser\Exception; class AdapterChain implements AdapterInterface diff --git a/src/ZfcUser/Authentication/Adapter/AdapterChainEvent.php b/src/ZfcUser/Authentication/Adapter/AdapterChainEvent.php index 4423f8de..a6235395 100644 --- a/src/ZfcUser/Authentication/Adapter/AdapterChainEvent.php +++ b/src/ZfcUser/Authentication/Adapter/AdapterChainEvent.php @@ -2,8 +2,8 @@ namespace ZfcUser\Authentication\Adapter; -use Zend\EventManager\Event; -use Zend\Stdlib\RequestInterface as Request; +use Laminas\EventManager\Event; +use Laminas\Stdlib\RequestInterface as Request; class AdapterChainEvent extends Event { diff --git a/src/ZfcUser/Authentication/Adapter/AdapterChainServiceFactory.php b/src/ZfcUser/Authentication/Adapter/AdapterChainServiceFactory.php index a5af75e7..05bc31a4 100644 --- a/src/ZfcUser/Authentication/Adapter/AdapterChainServiceFactory.php +++ b/src/ZfcUser/Authentication/Adapter/AdapterChainServiceFactory.php @@ -3,10 +3,10 @@ use Interop\Container\ContainerInterface; use Interop\Container\Exception\ContainerException; -use Zend\ServiceManager\Exception\ServiceNotCreatedException; -use Zend\ServiceManager\Exception\ServiceNotFoundException; -use Zend\ServiceManager\Factory\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\ServiceManager\Exception\ServiceNotCreatedException; +use Laminas\ServiceManager\Exception\ServiceNotFoundException; +use Laminas\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Authentication\Adapter\AdapterChain; use ZfcUser\Options\ModuleOptions; use ZfcUser\Authentication\Adapter\Exception\OptionsNotFoundException; diff --git a/src/ZfcUser/Authentication/Adapter/ChainableAdapter.php b/src/ZfcUser/Authentication/Adapter/ChainableAdapter.php index 8f297f0f..037e6de2 100644 --- a/src/ZfcUser/Authentication/Adapter/ChainableAdapter.php +++ b/src/ZfcUser/Authentication/Adapter/ChainableAdapter.php @@ -2,8 +2,8 @@ namespace ZfcUser\Authentication\Adapter; -use Zend\Authentication\Storage\StorageInterface; -use Zend\EventManager\EventInterface; +use Laminas\Authentication\Storage\StorageInterface; +use Laminas\EventManager\EventInterface; interface ChainableAdapter { diff --git a/src/ZfcUser/Authentication/Adapter/Db.php b/src/ZfcUser/Authentication/Adapter/Db.php index f8364b0d..e0ae2225 100644 --- a/src/ZfcUser/Authentication/Adapter/Db.php +++ b/src/ZfcUser/Authentication/Adapter/Db.php @@ -3,11 +3,11 @@ namespace ZfcUser\Authentication\Adapter; use Interop\Container\ContainerInterface; -use Zend\Authentication\Result as AuthenticationResult; -use Zend\EventManager\EventInterface; -use Zend\ServiceManager\ServiceManager; -use Zend\Crypt\Password\Bcrypt; -use Zend\Session\Container as SessionContainer; +use Laminas\Authentication\Result as AuthenticationResult; +use Laminas\EventManager\EventInterface; +use Laminas\ServiceManager\ServiceManager; +use Laminas\Crypt\Password\Bcrypt; +use Laminas\Session\Container as SessionContainer; use ZfcUser\Entity\UserInterface; use ZfcUser\Mapper\UserInterface as UserMapperInterface; use ZfcUser\Options\ModuleOptions; diff --git a/src/ZfcUser/Authentication/Adapter/Exception/OptionsNotFoundException.php b/src/ZfcUser/Authentication/Adapter/Exception/OptionsNotFoundException.php index 685d053a..dcb04361 100644 --- a/src/ZfcUser/Authentication/Adapter/Exception/OptionsNotFoundException.php +++ b/src/ZfcUser/Authentication/Adapter/Exception/OptionsNotFoundException.php @@ -2,7 +2,7 @@ namespace ZfcUser\Authentication\Adapter\Exception; -use Zend\Math\Exception\RuntimeException; +use Laminas\Math\Exception\RuntimeException; class OptionsNotFoundException extends RuntimeException { diff --git a/src/ZfcUser/Authentication/Storage/Db.php b/src/ZfcUser/Authentication/Storage/Db.php index 0a5383ee..c9b1b844 100644 --- a/src/ZfcUser/Authentication/Storage/Db.php +++ b/src/ZfcUser/Authentication/Storage/Db.php @@ -3,9 +3,9 @@ namespace ZfcUser\Authentication\Storage; use Interop\Container\ContainerInterface; -use Zend\Authentication\Storage; -use Zend\Authentication\Storage\StorageInterface; -use Zend\ServiceManager\ServiceManager; +use Laminas\Authentication\Storage; +use Laminas\Authentication\Storage\StorageInterface; +use Laminas\ServiceManager\ServiceManager; use ZfcUser\Mapper\UserInterface as UserMapper; class Db implements Storage\StorageInterface @@ -33,7 +33,7 @@ class Db implements Storage\StorageInterface /** * Returns true if and only if storage is empty * - * @throws \Zend\Authentication\Exception\InvalidArgumentException If it is impossible to determine whether + * @throws \Laminas\Authentication\Exception\InvalidArgumentException If it is impossible to determine whether * storage is empty or not * @return boolean */ @@ -56,7 +56,7 @@ public function isEmpty() * * Behavior is undefined when storage is empty. * - * @throws \Zend\Authentication\Exception\InvalidArgumentException If reading contents from storage is impossible + * @throws \Laminas\Authentication\Exception\InvalidArgumentException If reading contents from storage is impossible * @return mixed */ public function read() @@ -84,7 +84,7 @@ public function read() * Writes $contents to storage * * @param mixed $contents - * @throws \Zend\Authentication\Exception\InvalidArgumentException If writing $contents to storage is impossible + * @throws \Laminas\Authentication\Exception\InvalidArgumentException If writing $contents to storage is impossible * @return void */ public function write($contents) @@ -96,7 +96,7 @@ public function write($contents) /** * Clears contents from storage * - * @throws \Zend\Authentication\Exception\InvalidArgumentException If clearing contents from storage is impossible + * @throws \Laminas\Authentication\Exception\InvalidArgumentException If clearing contents from storage is impossible * @return void */ public function clear() diff --git a/src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php b/src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php index a3fd6cc8..7b7d810b 100644 --- a/src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php +++ b/src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php @@ -2,9 +2,9 @@ namespace ZfcUser\Controller\Plugin; -use Zend\Mvc\Controller\Plugin\AbstractPlugin; -use Zend\Authentication\AuthenticationService; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\Mvc\Controller\Plugin\AbstractPlugin; +use Laminas\Authentication\AuthenticationService; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Authentication\Adapter\AdapterChain as AuthAdapter; class ZfcUserAuthentication extends AbstractPlugin diff --git a/src/ZfcUser/Controller/RedirectCallback.php b/src/ZfcUser/Controller/RedirectCallback.php index 0056c3f2..8a4b35d4 100644 --- a/src/ZfcUser/Controller/RedirectCallback.php +++ b/src/ZfcUser/Controller/RedirectCallback.php @@ -2,10 +2,10 @@ namespace ZfcUser\Controller; -use Zend\Mvc\Application; -use Zend\Router\RouteInterface; -use Zend\Router\Exception; -use Zend\Http\PhpEnvironment\Response; +use Laminas\Mvc\Application; +use Laminas\Router\RouteInterface; +use Laminas\Router\Exception; +use Laminas\Http\PhpEnvironment\Response; use ZfcUser\Options\ModuleOptions; /** diff --git a/src/ZfcUser/Controller/UserController.php b/src/ZfcUser/Controller/UserController.php index 7c5a16bc..b011b06a 100644 --- a/src/ZfcUser/Controller/UserController.php +++ b/src/ZfcUser/Controller/UserController.php @@ -2,12 +2,12 @@ namespace ZfcUser\Controller; -use Zend\Form\FormInterface; -use Zend\Mvc\Controller\AbstractActionController; -use Zend\ServiceManager\ServiceLocatorInterface; -use Zend\Stdlib\ResponseInterface as Response; -use Zend\Stdlib\Parameters; -use Zend\View\Model\ViewModel; +use Laminas\Form\FormInterface; +use Laminas\Mvc\Controller\AbstractActionController; +use Laminas\ServiceManager\ServiceLocatorInterface; +use Laminas\Stdlib\ResponseInterface as Response; +use Laminas\Stdlib\Parameters; +use Laminas\View\Model\ViewModel; use ZfcUser\Service\User as UserService; use ZfcUser\Options\UserControllerOptionsInterface; diff --git a/src/ZfcUser/Db/Adapter/MasterSlaveAdapter.php b/src/ZfcUser/Db/Adapter/MasterSlaveAdapter.php index d6fd0016..40298192 100644 --- a/src/ZfcUser/Db/Adapter/MasterSlaveAdapter.php +++ b/src/ZfcUser/Db/Adapter/MasterSlaveAdapter.php @@ -1,9 +1,9 @@ get('ZfcUser\Authentication\Storage\Db'), $serviceLocator->get('ZfcUser\Authentication\Adapter\AdapterChain') ); diff --git a/src/ZfcUser/Factory/Controller/Plugin/ZfcUserAuthentication.php b/src/ZfcUser/Factory/Controller/Plugin/ZfcUserAuthentication.php index c11a45ce..f8e76d23 100644 --- a/src/ZfcUser/Factory/Controller/Plugin/ZfcUserAuthentication.php +++ b/src/ZfcUser/Factory/Controller/Plugin/ZfcUserAuthentication.php @@ -3,8 +3,8 @@ namespace ZfcUser\Factory\Controller\Plugin; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Controller; class ZfcUserAuthentication implements FactoryInterface diff --git a/src/ZfcUser/Factory/Controller/RedirectCallbackFactory.php b/src/ZfcUser/Factory/Controller/RedirectCallbackFactory.php index cf0c7fef..ea7da040 100644 --- a/src/ZfcUser/Factory/Controller/RedirectCallbackFactory.php +++ b/src/ZfcUser/Factory/Controller/RedirectCallbackFactory.php @@ -3,10 +3,10 @@ namespace ZfcUser\Factory\Controller; use Interop\Container\ContainerInterface; -use Zend\Mvc\Application; -use Zend\Router\RouteInterface; -use Zend\ServiceManager\Factory\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\Mvc\Application; +use Laminas\Router\RouteInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Controller\RedirectCallback; use ZfcUser\Options\ModuleOptions; diff --git a/src/ZfcUser/Factory/Controller/UserControllerFactory.php b/src/ZfcUser/Factory/Controller/UserControllerFactory.php index 760d9887..522633ec 100644 --- a/src/ZfcUser/Factory/Controller/UserControllerFactory.php +++ b/src/ZfcUser/Factory/Controller/UserControllerFactory.php @@ -3,9 +3,9 @@ namespace ZfcUser\Factory\Controller; use Interop\Container\ContainerInterface; -use Zend\Mvc\Controller\ControllerManager; -use Zend\ServiceManager\Factory\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\Mvc\Controller\ControllerManager; +use Laminas\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Controller\RedirectCallback; use ZfcUser\Controller\UserController; diff --git a/src/ZfcUser/Factory/Form/ChangeEmail.php b/src/ZfcUser/Factory/Form/ChangeEmail.php index cb7cef77..b3b930d7 100644 --- a/src/ZfcUser/Factory/Form/ChangeEmail.php +++ b/src/ZfcUser/Factory/Form/ChangeEmail.php @@ -3,7 +3,7 @@ namespace ZfcUser\Factory\Form; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; use ZfcUser\Form; use ZfcUser\Validator; diff --git a/src/ZfcUser/Factory/Form/ChangePassword.php b/src/ZfcUser/Factory/Form/ChangePassword.php index be498df1..ce3ac514 100644 --- a/src/ZfcUser/Factory/Form/ChangePassword.php +++ b/src/ZfcUser/Factory/Form/ChangePassword.php @@ -3,7 +3,7 @@ namespace ZfcUser\Factory\Form; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; use ZfcUser\Form; class ChangePassword implements FactoryInterface diff --git a/src/ZfcUser/Factory/Form/Login.php b/src/ZfcUser/Factory/Form/Login.php index 9cf93c2b..3c5ac0f9 100644 --- a/src/ZfcUser/Factory/Form/Login.php +++ b/src/ZfcUser/Factory/Form/Login.php @@ -3,7 +3,7 @@ namespace ZfcUser\Factory\Form; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; use ZfcUser\Form; class Login implements FactoryInterface diff --git a/src/ZfcUser/Factory/Form/Register.php b/src/ZfcUser/Factory/Form/Register.php index 56872f82..5b4d9e81 100644 --- a/src/ZfcUser/Factory/Form/Register.php +++ b/src/ZfcUser/Factory/Form/Register.php @@ -3,7 +3,7 @@ namespace ZfcUser\Factory\Form; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; use ZfcUser\Form; use ZfcUser\Validator; diff --git a/src/ZfcUser/Factory/Mapper/User.php b/src/ZfcUser/Factory/Mapper/User.php index 707dadba..b9b57f79 100644 --- a/src/ZfcUser/Factory/Mapper/User.php +++ b/src/ZfcUser/Factory/Mapper/User.php @@ -3,8 +3,8 @@ namespace ZfcUser\Factory\Mapper; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Mapper; use ZfcUser\Options\ModuleOptions; diff --git a/src/ZfcUser/Factory/Options/ModuleOptions.php b/src/ZfcUser/Factory/Options/ModuleOptions.php index 31e3f04b..5a9e9067 100644 --- a/src/ZfcUser/Factory/Options/ModuleOptions.php +++ b/src/ZfcUser/Factory/Options/ModuleOptions.php @@ -3,8 +3,8 @@ namespace ZfcUser\Factory\Options; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Options; class ModuleOptions implements FactoryInterface diff --git a/src/ZfcUser/Factory/Service/UserFactory.php b/src/ZfcUser/Factory/Service/UserFactory.php index ccee7804..5ce326bc 100644 --- a/src/ZfcUser/Factory/Service/UserFactory.php +++ b/src/ZfcUser/Factory/Service/UserFactory.php @@ -3,8 +3,8 @@ namespace ZfcUser\Factory\Service; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Service\User; class UserFactory implements FactoryInterface diff --git a/src/ZfcUser/Factory/UserHydrator.php b/src/ZfcUser/Factory/UserHydrator.php index 33a5f148..2510637d 100644 --- a/src/ZfcUser/Factory/UserHydrator.php +++ b/src/ZfcUser/Factory/UserHydrator.php @@ -3,14 +3,14 @@ namespace ZfcUser\Factory; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\ServiceLocatorInterface; class UserHydrator implements FactoryInterface { public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { - return new \Zend\Hydrator\ClassMethods(); + return new \Laminas\Hydrator\ClassMethods(); } diff --git a/src/ZfcUser/Factory/View/Helper/ZfcUserDisplayName.php b/src/ZfcUser/Factory/View/Helper/ZfcUserDisplayName.php index 802fead4..3eb05908 100644 --- a/src/ZfcUser/Factory/View/Helper/ZfcUserDisplayName.php +++ b/src/ZfcUser/Factory/View/Helper/ZfcUserDisplayName.php @@ -3,7 +3,7 @@ namespace ZfcUser\Factory\View\Helper; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; use ZfcUser\View; class ZfcUserDisplayName implements FactoryInterface diff --git a/src/ZfcUser/Factory/View/Helper/ZfcUserIdentity.php b/src/ZfcUser/Factory/View/Helper/ZfcUserIdentity.php index 07483b9a..d551d898 100644 --- a/src/ZfcUser/Factory/View/Helper/ZfcUserIdentity.php +++ b/src/ZfcUser/Factory/View/Helper/ZfcUserIdentity.php @@ -3,7 +3,7 @@ namespace ZfcUser\Factory\View\Helper; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; use ZfcUser\View; class ZfcUserIdentity implements FactoryInterface diff --git a/src/ZfcUser/Factory/View/Helper/ZfcUserLoginWidget.php b/src/ZfcUser/Factory/View/Helper/ZfcUserLoginWidget.php index 8d39d6e8..eeec79ee 100644 --- a/src/ZfcUser/Factory/View/Helper/ZfcUserLoginWidget.php +++ b/src/ZfcUser/Factory/View/Helper/ZfcUserLoginWidget.php @@ -3,7 +3,7 @@ namespace ZfcUser\Factory\View\Helper; use Interop\Container\ContainerInterface; -use Zend\ServiceManager\Factory\FactoryInterface; +use Laminas\ServiceManager\Factory\FactoryInterface; use ZfcUser\View; class ZfcUserLoginWidget implements FactoryInterface diff --git a/src/ZfcUser/Form/Base.php b/src/ZfcUser/Form/Base.php index 88d1b2ae..a08180d5 100644 --- a/src/ZfcUser/Form/Base.php +++ b/src/ZfcUser/Form/Base.php @@ -2,7 +2,7 @@ namespace ZfcUser\Form; -use Zend\Form\Element; +use Laminas\Form\Element; class Base extends ProvidesEventsForm { @@ -75,7 +75,7 @@ public function __construct($name = null) $this->add(array( 'name' => 'userId', - 'type' => 'Zend\Form\Element\Hidden', + 'type' => 'Laminas\Form\Element\Hidden', 'attributes' => array( 'type' => 'hidden' ), diff --git a/src/ZfcUser/Form/ChangeEmailFilter.php b/src/ZfcUser/Form/ChangeEmailFilter.php index b8a73d35..02434924 100644 --- a/src/ZfcUser/Form/ChangeEmailFilter.php +++ b/src/ZfcUser/Form/ChangeEmailFilter.php @@ -2,7 +2,7 @@ namespace ZfcUser\Form; -use Zend\InputFilter\InputFilter; +use Laminas\InputFilter\InputFilter; use ZfcUser\Options\AuthenticationOptionsInterface; class ChangeEmailFilter extends InputFilter diff --git a/src/ZfcUser/Form/ChangePasswordFilter.php b/src/ZfcUser/Form/ChangePasswordFilter.php index be6eb42c..9a61e7c6 100644 --- a/src/ZfcUser/Form/ChangePasswordFilter.php +++ b/src/ZfcUser/Form/ChangePasswordFilter.php @@ -2,7 +2,7 @@ namespace ZfcUser\Form; -use Zend\InputFilter\InputFilter; +use Laminas\InputFilter\InputFilter; use ZfcUser\Options\AuthenticationOptionsInterface; class ChangePasswordFilter extends InputFilter diff --git a/src/ZfcUser/Form/Login.php b/src/ZfcUser/Form/Login.php index 50f4ce4d..8330f33c 100644 --- a/src/ZfcUser/Form/Login.php +++ b/src/ZfcUser/Form/Login.php @@ -2,7 +2,7 @@ namespace ZfcUser\Form; -use Zend\Form\Element; +use Laminas\Form\Element; use ZfcUser\Options\AuthenticationOptionsInterface; class Login extends ProvidesEventsForm @@ -49,7 +49,7 @@ public function __construct($name, AuthenticationOptionsInterface $options) if ($this->getAuthenticationOptions()->getUseLoginFormCsrf()) { $this->add([ - 'type' => '\Zend\Form\Element\Csrf', + 'type' => '\Laminas\Form\Element\Csrf', 'name' => 'security', 'options' => [ 'csrf_options' => [ @@ -61,7 +61,7 @@ public function __construct($name, AuthenticationOptionsInterface $options) if ($this->getAuthenticationOptions()->getUseLoginFormCaptcha()) { $this->add(array( 'name' => 'captcha', - 'type' => 'Zend\Form\Element\Captcha', + 'type' => 'Laminas\Form\Element\Captcha', 'options' => array( 'label' => 'Human check', 'captcha' => $this->getAuthenticationOptions()->getFormCaptchaOptions(), diff --git a/src/ZfcUser/Form/ProvidesEventsForm.php b/src/ZfcUser/Form/ProvidesEventsForm.php index 44134957..62b56315 100644 --- a/src/ZfcUser/Form/ProvidesEventsForm.php +++ b/src/ZfcUser/Form/ProvidesEventsForm.php @@ -1,8 +1,8 @@ getRegistrationOptions()->getUseRegistrationFormCaptcha()) { $this->add(array( 'name' => 'captcha', - 'type' => 'Zend\Form\Element\Captcha', + 'type' => 'Laminas\Form\Element\Captcha', 'options' => array( 'label' => 'Please type the following text', 'captcha' => $this->getRegistrationOptions()->getFormCaptchaOptions(), diff --git a/src/ZfcUser/InputFilter/ProvidesEventsInputFilter.php b/src/ZfcUser/InputFilter/ProvidesEventsInputFilter.php index a3f00666..452ad906 100644 --- a/src/ZfcUser/InputFilter/ProvidesEventsInputFilter.php +++ b/src/ZfcUser/InputFilter/ProvidesEventsInputFilter.php @@ -1,8 +1,8 @@ assertInstanceOf('Zend\Authentication\Storage\Session', $this->adapter->getStorage()); + $this->assertInstanceOf('Laminas\Authentication\Storage\Session', $this->adapter->getStorage()); } /** @@ -32,11 +32,11 @@ public function testGetStorageWithoutStorageSet() */ public function testSetGetStorage() { - $storage = new \Zend\Authentication\Storage\Session('ZfcUser'); + $storage = new \Laminas\Authentication\Storage\Session('ZfcUser'); $storage->write('zfcUser'); $this->adapter->setStorage($storage); - $this->assertInstanceOf('Zend\Authentication\Storage\Session', $this->adapter->getStorage()); + $this->assertInstanceOf('Laminas\Authentication\Storage\Session', $this->adapter->getStorage()); $this->assertSame('zfcUser', $this->adapter->getStorage()->read()); } diff --git a/tests/ZfcUserTest/Authentication/Adapter/AdapterChainEventTest.php b/tests/ZfcUserTest/Authentication/Adapter/AdapterChainEventTest.php index 95153032..73c54e62 100644 --- a/tests/ZfcUserTest/Authentication/Adapter/AdapterChainEventTest.php +++ b/tests/ZfcUserTest/Authentication/Adapter/AdapterChainEventTest.php @@ -68,9 +68,9 @@ public function testIdentity() public function testRequest() { - $request = $this->getMock('Zend\Stdlib\RequestInterface'); + $request = $this->getMock('Laminas\Stdlib\RequestInterface'); $this->event->setRequest($request); - $this->assertInstanceOf('Zend\Stdlib\RequestInterface', $this->event->getRequest()); + $this->assertInstanceOf('Laminas\Stdlib\RequestInterface', $this->event->getRequest()); } } diff --git a/tests/ZfcUserTest/Authentication/Adapter/AdapterChainServiceFactoryTest.php b/tests/ZfcUserTest/Authentication/Adapter/AdapterChainServiceFactoryTest.php index ec9d1854..a7616cd3 100644 --- a/tests/ZfcUserTest/Authentication/Adapter/AdapterChainServiceFactoryTest.php +++ b/tests/ZfcUserTest/Authentication/Adapter/AdapterChainServiceFactoryTest.php @@ -14,7 +14,7 @@ class AdapterChainServiceFactoryTest extends \PHPUnit_Framework_TestCase protected $factory; /** - * @var \Zend\ServiceManager\ServiceLocatorInterface + * @var \Laminas\ServiceManager\ServiceLocatorInterface */ protected $serviceLocator; @@ -24,7 +24,7 @@ class AdapterChainServiceFactoryTest extends \PHPUnit_Framework_TestCase protected $options; /** - * @var \Zend\EventManager\EventManagerInterface + * @var \Laminas\EventManager\EventManagerInterface */ protected $eventManager; @@ -41,7 +41,7 @@ public function helperServiceLocator($index) */ protected function setUp() { - $this->serviceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface'); + $this->serviceLocator = $this->getMock('Laminas\ServiceManager\ServiceLocatorInterface'); $this->options = $this->getMockBuilder('ZfcUser\Options\ModuleOptions') ->disableOriginalConstructor() @@ -55,7 +55,7 @@ protected function setUp() ->method('get') ->will($this->returnCallback(array($this,'helperServiceLocator'))); - $this->eventManager = $this->getMock('Zend\EventManager\EventManager'); + $this->eventManager = $this->getMock('Laminas\EventManager\EventManager'); $this->factory = new AdapterChainServiceFactory(); } diff --git a/tests/ZfcUserTest/Authentication/Adapter/AdapterChainTest.php b/tests/ZfcUserTest/Authentication/Adapter/AdapterChainTest.php index 2530f6f9..66bacbf8 100644 --- a/tests/ZfcUserTest/Authentication/Adapter/AdapterChainTest.php +++ b/tests/ZfcUserTest/Authentication/Adapter/AdapterChainTest.php @@ -2,12 +2,12 @@ namespace ZfcUserTest\Authentication\Adapter; -use Zend\EventManager\EventInterface; -use Zend\EventManager\EventManagerInterface; -use Zend\EventManager\SharedEventManagerInterface; +use Laminas\EventManager\EventInterface; +use Laminas\EventManager\EventManagerInterface; +use Laminas\EventManager\SharedEventManagerInterface; use ZfcUser\Authentication\Adapter\AdapterChain; use ZfcUser\Authentication\Adapter\AdapterChainEvent; -use Zend\Stdlib\RequestInterface; +use Laminas\Stdlib\RequestInterface; class AdapterChainTest extends \PHPUnit_Framework_TestCase { @@ -56,10 +56,10 @@ protected function setUp() $this->adapterChain = new AdapterChain(); - $this->sharedEventManager = $this->getMock('Zend\EventManager\SharedEventManagerInterface'); + $this->sharedEventManager = $this->getMock('Laminas\EventManager\SharedEventManagerInterface'); //$this->sharedEventManager->expects($this->any())->method('getListeners')->will($this->returnValue([])); - $this->eventManager = $this->getMock('Zend\EventManager\EventManagerInterface'); + $this->eventManager = $this->getMock('Laminas\EventManager\EventManagerInterface'); $this->eventManager->expects($this->any())->method('getSharedManager')->will($this->returnValue($this->sharedEventManager)); $this->eventManager->expects($this->any())->method('setIdentifiers'); @@ -90,7 +90,7 @@ public function testAuthenticate() $this->adapterChain->setEvent($event); $result = $this->adapterChain->authenticate(); - $this->assertInstanceOf('Zend\Authentication\Result', $result); + $this->assertInstanceOf('Laminas\Authentication\Result', $result); $this->assertEquals($result->getIdentity(), 'identity'); $this->assertEquals($result->getMessages(), array()); } @@ -131,7 +131,7 @@ public function testResetAdapters() */ protected function setUpPrepareForAuthentication() { - $this->request = $this->getMock('Zend\Stdlib\RequestInterface'); + $this->request = $this->getMock('Laminas\Stdlib\RequestInterface'); $this->event = $this->getMock('ZfcUser\Authentication\Adapter\AdapterChainEvent'); $this->event->expects($this->once())->method('setRequest')->with($this->request); @@ -139,9 +139,9 @@ protected function setUpPrepareForAuthentication() $this->eventManager->expects($this->at(0))->method('trigger')->with('authenticate.pre'); /** - * @var $response \Zend\EventManager\ResponseCollection + * @var $response \Laminas\EventManager\ResponseCollection */ - $responses = $this->getMock('Zend\EventManager\ResponseCollection'); + $responses = $this->getMock('Laminas\EventManager\ResponseCollection'); $this->eventManager->expects($this->at(1)) ->method('trigger') @@ -206,7 +206,7 @@ public function testPrepareForAuthenticationWithStoppedEvent() $result->expects($this->once())->method('stopped')->will($this->returnValue(true)); - $lastResponse = $this->getMock('Zend\Stdlib\ResponseInterface'); + $lastResponse = $this->getMock('Laminas\Stdlib\ResponseInterface'); $result->expects($this->atLeastOnce())->method('last')->will($this->returnValue($lastResponse)); $this->assertEquals( @@ -283,7 +283,7 @@ public function testSetEventWithDifferentEventType() { $testParams = array('testParam' => 'testValue'); - $event = new \Zend\EventManager\Event; + $event = new \Laminas\EventManager\Event; $event->setParams($testParams); $this->adapterChain->setEvent($event); diff --git a/tests/ZfcUserTest/Authentication/Adapter/DbTest.php b/tests/ZfcUserTest/Authentication/Adapter/DbTest.php index 832bfea5..345105c9 100644 --- a/tests/ZfcUserTest/Authentication/Adapter/DbTest.php +++ b/tests/ZfcUserTest/Authentication/Adapter/DbTest.php @@ -2,7 +2,7 @@ namespace ZfcUserTest\Authentication\Adapter; -use Zend\EventManager\Event; +use Laminas\EventManager\Event; use ZfcUser\Authentication\Adapter\Db; class DbTest extends \PHPUnit_Framework_TestCase @@ -24,7 +24,7 @@ class DbTest extends \PHPUnit_Framework_TestCase /** * Mock of Storage. * - * @var \Zend\Authentication\Storage\Session|\PHPUnit_Framework_MockObject_MockObject + * @var \Laminas\Authentication\Storage\Session|\PHPUnit_Framework_MockObject_MockObject */ protected $storage; @@ -51,7 +51,7 @@ class DbTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $storage = $this->getMock('Zend\Authentication\Storage\Session'); + $storage = $this->getMock('Laminas\Authentication\Storage\Session'); $this->storage = $storage; $authEvent = $this->getMock('ZfcUser\Authentication\Adapter\AdapterChainEvent'); @@ -69,8 +69,8 @@ protected function setUp() $this->db = new Db; $this->db->setStorage($this->storage); - $sessionManager = $this->getMock('Zend\Session\SessionManager'); - \Zend\Session\AbstractContainer::setDefaultManager($sessionManager); + $sessionManager = $this->getMock('Laminas\Session\SessionManager'); + \Laminas\Session\AbstractContainer::setDefaultManager($sessionManager); } /** @@ -95,7 +95,7 @@ public function testAuthenticateWhenSatisfies() ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once()) ->method('setCode') - ->with(\Zend\Authentication\Result::SUCCESS) + ->with(\Laminas\Authentication\Result::SUCCESS) ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once()) ->method('setMessages') @@ -128,7 +128,7 @@ public function testAuthenticateNoUserObject() $this->authEvent->expects($this->once()) ->method('setCode') - ->with(\Zend\Authentication\Result::FAILURE_IDENTITY_NOT_FOUND) + ->with(\Laminas\Authentication\Result::FAILURE_IDENTITY_NOT_FOUND) ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once()) ->method('setMessages') @@ -161,7 +161,7 @@ public function testAuthenticationUserStateEnabledUserButUserStateNotInArray() $this->authEvent->expects($this->once()) ->method('setCode') - ->with(\Zend\Authentication\Result::FAILURE_UNCATEGORIZED) + ->with(\Laminas\Authentication\Result::FAILURE_UNCATEGORIZED) ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once()) ->method('setMessages') @@ -201,7 +201,7 @@ public function testAuthenticateWithWrongPassword() $this->authEvent->expects($this->once()) ->method('setCode') - ->with(\Zend\Authentication\Result::FAILURE_CREDENTIAL_INVALID) + ->with(\Laminas\Authentication\Result::FAILURE_CREDENTIAL_INVALID) ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once(1)) ->method('setMessages') @@ -250,7 +250,7 @@ public function testAuthenticationAuthenticatesWithEmail() ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once()) ->method('setCode') - ->with(\Zend\Authentication\Result::SUCCESS) + ->with(\Laminas\Authentication\Result::SUCCESS) ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once()) ->method('setMessages') @@ -304,7 +304,7 @@ public function testAuthenticationAuthenticates() ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once()) ->method('setCode') - ->with(\Zend\Authentication\Result::SUCCESS) + ->with(\Laminas\Authentication\Result::SUCCESS) ->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once()) ->method('setMessages') @@ -328,7 +328,7 @@ public function testUpdateUserPasswordHashWithSameCost() ->method('getPassword') ->will($this->returnValue('$2a$10$x05G2P803MrB3jaORBXBn.QHtiYzGQOBjQ7unpEIge.Mrz6c3KiVm')); - $bcrypt = $this->getMock('Zend\Crypt\Password\Bcrypt'); + $bcrypt = $this->getMock('Laminas\Crypt\Password\Bcrypt'); $bcrypt->expects($this->once()) ->method('getCost') ->will($this->returnValue('10')); @@ -356,7 +356,7 @@ public function testUpdateUserPasswordHashWithoutSameCost() ->method('setPassword') ->with('$2a$10$D41KPuDCn6iGoESjnLee/uE/2Xo985sotVySo2HKDz6gAO4hO/Gh6'); - $bcrypt = $this->getMock('Zend\Crypt\Password\Bcrypt'); + $bcrypt = $this->getMock('Laminas\Crypt\Password\Bcrypt'); $bcrypt->expects($this->once()) ->method('getCost') ->will($this->returnValue('5')); @@ -419,13 +419,13 @@ public function testPreprocessCredentialWithoutCallable() */ public function testSetGetServicemanager() { - $sm = $this->getMock('Zend\ServiceManager\ServiceManager'); + $sm = $this->getMock('Laminas\ServiceManager\ServiceManager'); $this->db->setServiceManager($sm); $serviceManager = $this->db->getServiceManager(); - $this->assertInstanceOf('Zend\ServiceManager\ServiceLocatorInterface', $serviceManager); + $this->assertInstanceOf('Laminas\ServiceManager\ServiceLocatorInterface', $serviceManager); $this->assertSame($sm, $serviceManager); } @@ -434,7 +434,7 @@ public function testSetGetServicemanager() */ public function testGetOptionsWithNoOptionsSet() { - $serviceMapper = $this->getMock('Zend\ServiceManager\ServiceManager'); + $serviceMapper = $this->getMock('Laminas\ServiceManager\ServiceManager'); $serviceMapper->expects($this->once()) ->method('get') ->with('zfcuser_module_options') @@ -468,7 +468,7 @@ public function testSetGetOptions() */ public function testGetMapperWithNoMapperSet() { - $serviceMapper = $this->getMock('Zend\ServiceManager\ServiceManager'); + $serviceMapper = $this->getMock('Laminas\ServiceManager\ServiceManager'); $serviceMapper->expects($this->once()) ->method('get') ->with('zfcuser_user_mapper') @@ -526,7 +526,7 @@ protected function setAuthenticationCredentials($identity = 'ZfcUser', $credenti ->method('read') ->will($this->returnValue(array('is_satisfied' => false))); - $post = $this->getMock('Zend\Stdlib\Parameters'); + $post = $this->getMock('Laminas\Stdlib\Parameters'); $post->expects($this->at(0)) ->method('get') ->with('identity') @@ -536,7 +536,7 @@ protected function setAuthenticationCredentials($identity = 'ZfcUser', $credenti ->with('credential') ->will($this->returnValue($credential)); - $request = $this->getMock('Zend\Http\Request'); + $request = $this->getMock('Laminas\Http\Request'); $request->expects($this->exactly(2)) ->method('getPost') ->will($this->returnValue($post)); diff --git a/tests/ZfcUserTest/Authentication/Adapter/TestAsset/AbstractAdapterExtension.php b/tests/ZfcUserTest/Authentication/Adapter/TestAsset/AbstractAdapterExtension.php index f7981cba..775e855f 100644 --- a/tests/ZfcUserTest/Authentication/Adapter/TestAsset/AbstractAdapterExtension.php +++ b/tests/ZfcUserTest/Authentication/Adapter/TestAsset/AbstractAdapterExtension.php @@ -2,7 +2,7 @@ namespace ZfcUserTest\Authentication\Adapter\TestAsset; -use Zend\EventManager\EventInterface; +use Laminas\EventManager\EventInterface; use ZfcUser\Authentication\Adapter\AbstractAdapter; class AbstractAdapterExtension extends AbstractAdapter diff --git a/tests/ZfcUserTest/Authentication/Storage/DbTest.php b/tests/ZfcUserTest/Authentication/Storage/DbTest.php index f7a0ae84..84c05a6c 100644 --- a/tests/ZfcUserTest/Authentication/Storage/DbTest.php +++ b/tests/ZfcUserTest/Authentication/Storage/DbTest.php @@ -32,7 +32,7 @@ public function setUp() $db = new Db; $this->db = $db; - $this->storage = $this->getMock('Zend\Authentication\Storage\Session'); + $this->storage = $this->getMock('Laminas\Authentication\Storage\Session'); $this->mapper = $this->getMock('ZfcUser\Mapper\User'); } @@ -175,7 +175,7 @@ public function testClear() */ public function testGetMapperWithNoMapperSet() { - $sm = $this->getMock('Zend\ServiceManager\ServiceManager'); + $sm = $this->getMock('Laminas\ServiceManager\ServiceManager'); $sm->expects($this->once()) ->method('get') ->with('zfcuser_user_mapper') @@ -207,11 +207,11 @@ public function testSetGetMapper() */ public function testSetGetServicemanager() { - $sm = $this->getMock('Zend\ServiceManager\ServiceManager'); + $sm = $this->getMock('Laminas\ServiceManager\ServiceManager'); $this->db->setServiceManager($sm); - $this->assertInstanceOf('Zend\ServiceManager\ServiceLocatorInterface', $this->db->getServiceManager()); + $this->assertInstanceOf('Laminas\ServiceManager\ServiceLocatorInterface', $this->db->getServiceManager()); $this->assertSame($sm, $this->db->getServiceManager()); } @@ -221,7 +221,7 @@ public function testSetGetServicemanager() */ public function testGetStorageWithoutStorageSet() { - $this->assertInstanceOf('Zend\Authentication\Storage\Session', $this->db->getStorage()); + $this->assertInstanceOf('Laminas\Authentication\Storage\Session', $this->db->getStorage()); } /** @@ -230,9 +230,9 @@ public function testGetStorageWithoutStorageSet() */ public function testSetGetStorage() { - $storage = new \Zend\Authentication\Storage\Session('ZfcUserStorage'); + $storage = new \Laminas\Authentication\Storage\Session('ZfcUserStorage'); $this->db->setStorage($storage); - $this->assertInstanceOf('Zend\Authentication\Storage\Session', $this->db->getStorage()); + $this->assertInstanceOf('Laminas\Authentication\Storage\Session', $this->db->getStorage()); } } diff --git a/tests/ZfcUserTest/Controller/Plugin/ZfcUserAuthenticationTest.php b/tests/ZfcUserTest/Controller/Plugin/ZfcUserAuthenticationTest.php index e48ed4e0..389e237c 100644 --- a/tests/ZfcUserTest/Controller/Plugin/ZfcUserAuthenticationTest.php +++ b/tests/ZfcUserTest/Controller/Plugin/ZfcUserAuthenticationTest.php @@ -3,8 +3,8 @@ namespace ZfcUserTest\Controller\Plugin; use ZfcUser\Controller\Plugin\ZfcUserAuthentication as Plugin; -use Zend\Authentication\AuthenticationService; -use Zend\Authentication\Adapter\AdapterInterface; +use Laminas\Authentication\AuthenticationService; +use Laminas\Authentication\Adapter\AdapterInterface; use ZfcUser\Authentication\Adapter\AdapterChain; class ZfcUserAuthenticationTest extends \PHPUnit_Framework_TestCase @@ -30,7 +30,7 @@ class ZfcUserAuthenticationTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->SUT = new Plugin(); - $this->mockedAuthenticationService = $this->getMock('Zend\Authentication\AuthenticationService'); + $this->mockedAuthenticationService = $this->getMock('Laminas\Authentication\AuthenticationService'); $this->mockedAuthenticationAdapter = $this->getMockForAbstractClass('\ZfcUser\Authentication\Adapter\AdapterChain'); } @@ -78,12 +78,12 @@ public function testSetAndGetAuthAdapter() $adapter2 = new AdapterChain(); $this->SUT->setAuthAdapter($adapter1); - $this->assertInstanceOf('\Zend\Authentication\Adapter\AdapterInterface', $this->SUT->getAuthAdapter()); + $this->assertInstanceOf('\Laminas\Authentication\Adapter\AdapterInterface', $this->SUT->getAuthAdapter()); $this->assertSame($adapter1, $this->SUT->getAuthAdapter()); $this->SUT->setAuthAdapter($adapter2); - $this->assertInstanceOf('\Zend\Authentication\Adapter\AdapterInterface', $this->SUT->getAuthAdapter()); + $this->assertInstanceOf('\Laminas\Authentication\Adapter\AdapterInterface', $this->SUT->getAuthAdapter()); $this->assertNotSame($adapter1, $this->SUT->getAuthAdapter()); $this->assertSame($adapter2, $this->SUT->getAuthAdapter()); } @@ -98,12 +98,12 @@ public function testSetAndGetAuthService() $service2 = new AuthenticationService(); $this->SUT->setAuthService($service1); - $this->assertInstanceOf('\Zend\Authentication\AuthenticationService', $this->SUT->getAuthService()); + $this->assertInstanceOf('\Laminas\Authentication\AuthenticationService', $this->SUT->getAuthService()); $this->assertSame($service1, $this->SUT->getAuthService()); $this->SUT->setAuthService($service2); - $this->assertInstanceOf('\Zend\Authentication\AuthenticationService', $this->SUT->getAuthService()); + $this->assertInstanceOf('\Laminas\Authentication\AuthenticationService', $this->SUT->getAuthService()); $this->assertNotSame($service1, $this->SUT->getAuthService()); $this->assertSame($service2, $this->SUT->getAuthService()); } diff --git a/tests/ZfcUserTest/Controller/RedirectCallbackTest.php b/tests/ZfcUserTest/Controller/RedirectCallbackTest.php index cf96ae88..831e4789 100644 --- a/tests/ZfcUserTest/Controller/RedirectCallbackTest.php +++ b/tests/ZfcUserTest/Controller/RedirectCallbackTest.php @@ -2,12 +2,12 @@ namespace ZfcUserTest\Controller; -use Zend\Http\PhpEnvironment\Request; -use Zend\Http\PhpEnvironment\Response; -use Zend\Mvc\Application; -use Zend\Mvc\MvcEvent; -use Zend\Router\RouteInterface; -use Zend\Router\RouteMatch; +use Laminas\Http\PhpEnvironment\Request; +use Laminas\Http\PhpEnvironment\Response; +use Laminas\Mvc\Application; +use Laminas\Mvc\MvcEvent; +use Laminas\Router\RouteInterface; +use Laminas\Router\RouteMatch; use ZfcUser\Controller\RedirectCallback; use ZfcUser\Options\ModuleOptions; @@ -40,7 +40,7 @@ class RedirectCallbackTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->router = $this->getMockBuilder('Zend\Router\RouteInterface') + $this->router = $this->getMockBuilder('Laminas\Router\RouteInterface') ->disableOriginalConstructor() ->getMock(); @@ -48,7 +48,7 @@ public function setUp() ->disableOriginalConstructor() ->getMock(); - $this->application = $this->getMockBuilder('Zend\Mvc\Application') + $this->application = $this->getMockBuilder('Laminas\Mvc\Application') ->disableOriginalConstructor() ->getMock(); $this->setUpApplication(); @@ -68,7 +68,7 @@ public function testInvoke() ->method('getMatchedRouteName') ->will($this->returnValue('someRoute')); - $headers = $this->getMock('Zend\Http\Headers'); + $headers = $this->getMock('Laminas\Http\Headers'); $headers->expects($this->once()) ->method('addHeaderLine') ->with('Location', $url); @@ -146,11 +146,11 @@ public function providerGetRedirectRouteFromRequest() array('user', false, $this->returnValue('route'), false), array('user', false, $this->returnValue('route'), $this->returnValue(true)), array('user', 'user', $this->returnValue('route'), $this->returnValue(true)), - array('user', 'user', $this->throwException(new \Zend\Router\Exception\RuntimeException), $this->returnValue(true)), - array('user', 'user', $this->throwException(new \Zend\Router\Exception\RuntimeException), $this->throwException(new \Zend\Router\Exception\RuntimeException)), + array('user', 'user', $this->throwException(new \Laminas\Router\Exception\RuntimeException), $this->returnValue(true)), + array('user', 'user', $this->throwException(new \Laminas\Router\Exception\RuntimeException), $this->throwException(new \Laminas\Router\Exception\RuntimeException)), array(false, 'user', false, $this->returnValue(true)), - array(false, 'user', false, $this->throwException(new \Zend\Router\Exception\RuntimeException)), - array(false, 'user', false, $this->throwException(new \Zend\Router\Exception\RuntimeException)), + array(false, 'user', false, $this->throwException(new \Laminas\Router\Exception\RuntimeException)), + array(false, 'user', false, $this->throwException(new \Laminas\Router\Exception\RuntimeException)), ); } @@ -179,7 +179,7 @@ public function testRouteExistsRouteDoesntExists() $this->router->expects($this->once()) ->method('assemble') ->with(array(), array('name' => $route)) - ->will($this->throwException(new \Zend\Router\Exception\RuntimeException)); + ->will($this->throwException(new \Laminas\Router\Exception\RuntimeException)); $method = new \ReflectionMethod( 'ZfcUser\Controller\RedirectCallback', @@ -274,7 +274,7 @@ public function testGetRedirectWithOptionOnRedirectDoesntExists() $this->router->expects($this->at(0)) ->method('assemble') ->with(array(), array('name' => $redirect)) - ->will($this->throwException(new \Zend\Router\Exception\RuntimeException)); + ->will($this->throwException(new \Laminas\Router\Exception\RuntimeException)); $this->router->expects($this->at(1)) ->method('assemble') @@ -297,19 +297,19 @@ public function testGetRedirectWithOptionOnRedirectDoesntExists() private function setUpApplication() { - $this->request = $this->getMockBuilder('Zend\Http\PhpEnvironment\Request') + $this->request = $this->getMockBuilder('Laminas\Http\PhpEnvironment\Request') ->disableOriginalConstructor() ->getMock(); - $this->response = $this->getMockBuilder('Zend\Http\PhpEnvironment\Response') + $this->response = $this->getMockBuilder('Laminas\Http\PhpEnvironment\Response') ->disableOriginalConstructor() ->getMock(); - $this->routeMatch = $this->getMockBuilder('Zend\Router\RouteMatch') + $this->routeMatch = $this->getMockBuilder('Laminas\Router\RouteMatch') ->disableOriginalConstructor() ->getMock(); - $this->mvcEvent = $this->getMockBuilder('Zend\Mvc\MvcEvent') + $this->mvcEvent = $this->getMockBuilder('Laminas\Mvc\MvcEvent') ->disableOriginalConstructor() ->getMock(); $this->mvcEvent->expects($this->any()) diff --git a/tests/ZfcUserTest/Controller/UserControllerTest.php b/tests/ZfcUserTest/Controller/UserControllerTest.php index 57e66a45..6957ec44 100644 --- a/tests/ZfcUserTest/Controller/UserControllerTest.php +++ b/tests/ZfcUserTest/Controller/UserControllerTest.php @@ -2,14 +2,14 @@ namespace ZfcUserTest\Controller; -use Zend\Form\FormElementManager; +use Laminas\Form\FormElementManager; use ZfcUser\Controller\RedirectCallback; use ZfcUser\Controller\UserController as Controller; -use Zend\Http\Response; -use Zend\Stdlib\Parameters; -use Zend\ServiceManager\ServiceLocatorInterface; +use Laminas\Http\Response; +use Laminas\Stdlib\Parameters; +use Laminas\ServiceManager\ServiceLocatorInterface; use ZfcUser\Service\User as UserService; -use Zend\Form\Form; +use Laminas\Form\Form; use ZfcUser\Options\ModuleOptions; use ZfcUser\Entity\User as UserIdentity; @@ -44,7 +44,7 @@ public function setUp() $this->zfcUserAuthenticationPlugin = $this->getMock('ZfcUser\Controller\Plugin\ZfcUserAuthentication'); - $pluginManager = $this->getMockBuilder('Zend\Mvc\Controller\PluginManager') + $pluginManager = $this->getMockBuilder('Laminas\Mvc\Controller\PluginManager') ->disableOriginalConstructor() ->getMock(); @@ -117,7 +117,7 @@ public function testActionControllHasIdentity($methodeName, $hasIdentity, $redir ->will($this->returnValue($redirectRoute)); } - $redirect = $this->getMock('Zend\Mvc\Controller\Plugin\Redirect'); + $redirect = $this->getMock('Laminas\Mvc\Controller\Plugin\Redirect'); $redirect->expects($this->once()) ->method('toRoute') ->with($redirectRoute) @@ -127,7 +127,7 @@ public function testActionControllHasIdentity($methodeName, $hasIdentity, $redir $result = call_user_func(array($controller, $methodeName)); - $this->assertInstanceOf('Zend\Http\Response', $result); + $this->assertInstanceOf('Laminas\Http\Response', $result); $this->assertSame($response, $result); } @@ -143,7 +143,7 @@ public function testIndexActionLoggedIn() $result = $controller->indexAction(); - $this->assertInstanceOf('Zend\View\Model\ViewModel', $result); + $this->assertInstanceOf('Laminas\View\Model\ViewModel', $result); } @@ -161,7 +161,7 @@ public function testLoginActionValidFormRedirectFalse($isValid, $wantRedirect) )); $flashMessenger = $this->getMock( - 'Zend\Mvc\Plugin\FlashMessenger\FlashMessenger' + 'Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger' ); $this->pluginManagerPlugins['flashMessenger']= $flashMessenger; @@ -175,7 +175,7 @@ public function testLoginActionValidFormRedirectFalse($isValid, $wantRedirect) ->will($this->returnSelf()); $postArray = array('some', 'data'); - $request = $this->getMock('Zend\Http\Request'); + $request = $this->getMock('Laminas\Http\Request'); $request->expects($this->any()) ->method('isPost') ->will($this->returnValue(true)); @@ -211,7 +211,7 @@ public function testLoginActionValidFormRedirectFalse($isValid, $wantRedirect) $adapter->expects($this->once()) ->method('resetAdapters'); - $service = $this->getMock('Zend\Authentication\AuthenticationService'); + $service = $this->getMock('Laminas\Authentication\AuthenticationService'); $service->expects($this->once()) ->method('clearIdentity'); @@ -226,7 +226,7 @@ public function testLoginActionValidFormRedirectFalse($isValid, $wantRedirect) $expectedResult = new \stdClass(); - $forwardPlugin = $this->getMockBuilder('Zend\Mvc\Controller\Plugin\Forward') + $forwardPlugin = $this->getMockBuilder('Laminas\Mvc\Controller\Plugin\Forward') ->disableOriginalConstructor() ->getMock(); $forwardPlugin->expects($this->once()) @@ -242,7 +242,7 @@ public function testLoginActionValidFormRedirectFalse($isValid, $wantRedirect) $route_url = "/user/login"; - $redirect = $this->getMock('Zend\Mvc\Controller\Plugin\Redirect', array('toUrl')); + $redirect = $this->getMock('Laminas\Mvc\Controller\Plugin\Redirect', array('toUrl')); $redirect->expects($this->any()) ->method('toUrl') ->with($route_url . $redirectQuery) @@ -257,7 +257,7 @@ public function testLoginActionValidFormRedirectFalse($isValid, $wantRedirect) $response = new Response(); - $url = $this->getMock('Zend\Mvc\Controller\Plugin\Url', array('fromRoute')); + $url = $this->getMock('Laminas\Mvc\Controller\Plugin\Url', array('fromRoute')); $url->expects($this->once()) ->method('fromRoute') ->with($controller::ROUTE_LOGIN) @@ -274,7 +274,7 @@ public function testLoginActionValidFormRedirectFalse($isValid, $wantRedirect) if ($isValid) { $this->assertSame($expectedResult, $result); } else { - $this->assertInstanceOf('Zend\Http\Response', $result); + $this->assertInstanceOf('Laminas\Http\Response', $result); $this->assertEquals($response, $result); $this->assertEquals($route_url . $redirectQuery, $result->getHeaders()->get('Location')->getFieldValue()); } @@ -290,11 +290,11 @@ public function testLoginActionIsNotPost($redirect) 'hasIdentity'=>false )); - $flashMessenger = $this->getMock('Zend\Mvc\Plugin\FlashMessenger\FlashMessenger'); + $flashMessenger = $this->getMock('Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger'); $this->pluginManagerPlugins['flashMessenger'] = $flashMessenger; - $request = $this->getMock('Zend\Http\Request'); + $request = $this->getMock('Laminas\Http\Request'); $request->expects($this->once()) ->method('isPost') ->will($this->returnValue(false)); @@ -354,7 +354,7 @@ public function testLogoutAction($withRedirect, $post, $query) $adapter->expects($this->once()) ->method('logoutAdapters'); - $service = $this->getMock('Zend\Authentication\AuthenticationService'); + $service = $this->getMock('Laminas\Authentication\AuthenticationService'); $service->expects($this->once()) ->method('clearIdentity'); @@ -372,7 +372,7 @@ public function testLogoutAction($withRedirect, $post, $query) $result = $controller->logoutAction(); - $this->assertInstanceOf('Zend\Http\Response', $result); + $this->assertInstanceOf('Laminas\Http\Response', $result); $this->assertSame($response, $result); } @@ -391,7 +391,7 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes $response = new Response(); $hasRedirect = !(is_null($query) && is_null($post)); - $params = $this->getMock('Zend\Mvc\Controller\Plugin\Params'); + $params = $this->getMock('Laminas\Mvc\Controller\Plugin\Params'); $params->expects($this->any()) ->method('__invoke') ->will($this->returnSelf()); @@ -408,7 +408,7 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes $this->pluginManagerPlugins['params'] = $params; - $request = $this->getMock('Zend\Http\Request'); + $request = $this->getMock('Laminas\Http\Request'); $this->helperMakePropertyAccessable($controller, 'request', $request); @@ -418,7 +418,7 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes ->with($request) ->will($this->returnValue($prepareResult)); - $service = $this->getMock('Zend\Authentication\AuthenticationService'); + $service = $this->getMock('Laminas\Authentication\AuthenticationService'); $this->setUpZfcUserAuthenticationPlugin(array( @@ -428,7 +428,7 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes )); if (is_bool($prepareResult)) { - $authResult = $this->getMockBuilder('Zend\Authentication\Result') + $authResult = $this->getMockBuilder('Laminas\Authentication\Result') ->disableOriginalConstructor() ->getMock(); $authResult->expects($this->once()) @@ -440,12 +440,12 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes ->with($adapter) ->will($this->returnValue($authResult)); - $redirect = $this->getMock('Zend\Mvc\Controller\Plugin\Redirect'); + $redirect = $this->getMock('Laminas\Mvc\Controller\Plugin\Redirect'); $this->pluginManagerPlugins['redirect'] = $redirect; if (!$authValid) { $flashMessenger = $this->getMock( - 'Zend\Mvc\Plugin\FlashMessenger\FlashMessenger' + 'Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger' ); $this->pluginManagerPlugins['flashMessenger']= $flashMessenger; @@ -468,7 +468,7 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes ->with('user/login' . $redirectQuery) ->will($this->returnValue($response)); - $url = $this->getMock('Zend\Mvc\Controller\Plugin\Url'); + $url = $this->getMock('Laminas\Mvc\Controller\Plugin\Url'); $url->expects($this->once()) ->method('fromRoute') ->with($controller::ROUTE_LOGIN) @@ -533,13 +533,13 @@ public function testRegisterAction($wantRedirect, $postRedirectGetReturn, $regis ->method('getEnableRegistration') ->will($this->returnValue(true)); - $request = $this->getMock('Zend\Http\Request'); + $request = $this->getMock('Laminas\Http\Request'); $this->helperMakePropertyAccessable($controller, 'request', $request); $userService = $this->getMock('ZfcUser\Service\User'); $controller->setUserService($userService); - $form = $this->getMockBuilder('Zend\Form\Form') + $form = $this->getMockBuilder('Laminas\Form\Form') ->disableOriginalConstructor() ->getMock(); @@ -559,7 +559,7 @@ public function testRegisterAction($wantRedirect, $postRedirectGetReturn, $regis } - $url = $this->getMock('Zend\Mvc\Controller\Plugin\Url'); + $url = $this->getMock('Laminas\Mvc\Controller\Plugin\Url'); $url->expects($this->at(0)) ->method('fromRoute') ->with($controller::ROUTE_REGISTER) @@ -567,7 +567,7 @@ public function testRegisterAction($wantRedirect, $postRedirectGetReturn, $regis $this->pluginManagerPlugins['url']= $url; - $prg = $this->getMock('Zend\Mvc\Plugin\Prg\PostRedirectGet'); + $prg = $this->getMock('Laminas\Mvc\Plugin\Prg\PostRedirectGet'); $this->pluginManagerPlugins['prg'] = $prg; $redirectQuery = $wantRedirect ? '?redirect=' . rawurlencode($redirectUrl) : ''; @@ -601,7 +601,7 @@ public function testRegisterAction($wantRedirect, $postRedirectGetReturn, $regis $expectedResult = new \stdClass(); - $forwardPlugin = $this->getMockBuilder('Zend\Mvc\Controller\Plugin\Forward') + $forwardPlugin = $this->getMockBuilder('Laminas\Mvc\Controller\Plugin\Forward') ->disableOriginalConstructor() ->getMock(); $forwardPlugin->expects($this->once()) @@ -620,7 +620,7 @@ public function testRegisterAction($wantRedirect, $postRedirectGetReturn, $regis $redirectQuery = $redirectUrl ? '?redirect='. rawurlencode($redirectUrl) : ''; - $redirect = $this->getMock('Zend\Mvc\Controller\Plugin\Redirect'); + $redirect = $this->getMock('Laminas\Mvc\Controller\Plugin\Redirect'); $redirect->expects($this->once()) ->method('toUrl') ->with($route_url . $redirectQuery) @@ -673,7 +673,7 @@ public function testRegisterAction($wantRedirect, $postRedirectGetReturn, $regis $this->assertArrayHasKey('redirect', $result); $this->assertEquals($expectedResult, $result); } else { - $this->assertInstanceOf('Zend\Http\Response', $result); + $this->assertInstanceOf('Laminas\Http\Response', $result); $this->assertSame($response, $result); } } @@ -692,7 +692,7 @@ public function testChangepasswordAction($status, $postRedirectGetReturn, $isVal 'hasIdentity'=>true )); - $form = $this->getMockBuilder('Zend\Form\Form') + $form = $this->getMockBuilder('Laminas\Form\Form') ->disableOriginalConstructor() ->getMock(); @@ -701,7 +701,7 @@ public function testChangepasswordAction($status, $postRedirectGetReturn, $isVal $flashMessenger = $this->getMock( - 'Zend\Mvc\Plugin\FlashMessenger\FlashMessenger' + 'Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger' ); $this->pluginManagerPlugins['flashMessenger']= $flashMessenger; @@ -715,7 +715,7 @@ public function testChangepasswordAction($status, $postRedirectGetReturn, $isVal ->will($this->returnValue($status ? array('test') : array())); - $prg = $this->getMock('Zend\Mvc\Plugin\Prg\PostRedirectGet'); + $prg = $this->getMock('Laminas\Mvc\Plugin\Prg\PostRedirectGet'); $this->pluginManagerPlugins['prg'] = $prg; @@ -754,7 +754,7 @@ public function testChangepasswordAction($status, $postRedirectGetReturn, $isVal ->with(true); - $redirect = $this->getMock('Zend\Mvc\Controller\Plugin\Redirect'); + $redirect = $this->getMock('Laminas\Mvc\Controller\Plugin\Redirect'); $redirect->expects($this->once()) ->method('toRoute') ->with($controller::ROUTE_CHANGEPASSWD) @@ -770,7 +770,7 @@ public function testChangepasswordAction($status, $postRedirectGetReturn, $isVal $exceptedReturn = null; if ($postRedirectGetReturn instanceof Response) { - $this->assertInstanceOf('Zend\Http\Response', $result); + $this->assertInstanceOf('Laminas\Http\Response', $result); $this->assertSame($postRedirectGetReturn, $result); } else { if ($postRedirectGetReturn === false) { @@ -790,7 +790,7 @@ public function testChangepasswordAction($status, $postRedirectGetReturn, $isVal $this->assertArrayHasKey('changePasswordForm', $result); $this->assertEquals($exceptedReturn, $result); } else { - $this->assertInstanceOf('Zend\Http\Response', $result); + $this->assertInstanceOf('Laminas\Http\Response', $result); $this->assertSame($response, $result); } } @@ -806,7 +806,7 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid, $controller = $this->controller; $response = new Response(); $userService = $this->getMock('ZfcUser\Service\User'); - $authService = $this->getMock('Zend\Authentication\AuthenticationService'); + $authService = $this->getMock('Laminas\Authentication\AuthenticationService'); $identity = new UserIdentity(); $controller->setUserService($userService); @@ -815,7 +815,7 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid, 'hasIdentity'=>true )); - $form = $this->getMockBuilder('Zend\Form\Form') + $form = $this->getMockBuilder('Laminas\Form\Form') ->disableOriginalConstructor() ->getMock(); @@ -831,12 +831,12 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid, $identity->setEmail('user@example.com'); - $requestParams = $this->getMock('Zend\Stdlib\Parameters'); + $requestParams = $this->getMock('Laminas\Stdlib\Parameters'); $requestParams->expects($this->once()) ->method('set') ->with('identity', $identity->getEmail()); - $request = $this->getMock('Zend\Http\Request'); + $request = $this->getMock('Laminas\Http\Request'); $request->expects($this->once()) ->method('getPost') ->will($this->returnValue($requestParams)); @@ -845,7 +845,7 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid, $flashMessenger = $this->getMock( - 'Zend\Mvc\Plugin\FlashMessenger\FlashMessenger' + 'Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger' ); $this->pluginManagerPlugins['flashMessenger']= $flashMessenger; @@ -859,7 +859,7 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid, ->will($this->returnValue($status ? array('test') : array())); - $prg = $this->getMock('Zend\Mvc\Plugin\Prg\PostRedirectGet'); + $prg = $this->getMock('Laminas\Mvc\Plugin\Prg\PostRedirectGet'); $this->pluginManagerPlugins['prg'] = $prg; @@ -890,7 +890,7 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid, ->with(true); - $redirect = $this->getMock('Zend\Mvc\Controller\Plugin\Redirect'); + $redirect = $this->getMock('Laminas\Mvc\Controller\Plugin\Redirect'); $redirect->expects($this->once()) ->method('toRoute') ->with($controller::ROUTE_CHANGEEMAIL) @@ -910,7 +910,7 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid, $exceptedReturn = null; if ($postRedirectGetReturn instanceof Response) { - $this->assertInstanceOf('Zend\Http\Response', $result); + $this->assertInstanceOf('Laminas\Http\Response', $result); $this->assertSame($postRedirectGetReturn, $result); } else { if ($postRedirectGetReturn === false) { @@ -931,7 +931,7 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid, $this->assertArrayHasKey('changeEmailForm', $result); $this->assertEquals($exceptedReturn, $result); } else { - $this->assertInstanceOf('Zend\Http\Response', $result); + $this->assertInstanceOf('Laminas\Http\Response', $result); $this->assertSame($response, $result); } } @@ -956,7 +956,7 @@ public function testSetterGetterServices( } if ($useServiceLocator) { - $serviceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface'); + $serviceLocator = $this->getMock('Laminas\ServiceManager\ServiceLocatorInterface'); $serviceLocator->expects($this->once()) ->method('get') ->with($serviceName) @@ -1035,7 +1035,7 @@ public function providerTestSetterGetterServices() $that = $this; $loginFormCallback[] = function ($that, $controller) { $flashMessenger = $that->getMock( - 'Zend\Mvc\Plugin\FlashMessenger\FlashMessenger' + 'Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger' ); $that->pluginManagerPlugins['flashMessenger']= $flashMessenger; @@ -1046,7 +1046,7 @@ public function providerTestSetterGetterServices() }; $loginFormCallback[] = function ($that, $controller) { $flashMessenger = $that->getMock( - 'Zend\Mvc\Plugin\FlashMessenger\FlashMessenger' + 'Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger' ); $that->pluginManagerPlugins['flashMessenger']= $flashMessenger; diff --git a/tests/ZfcUserTest/Factory/Form/ChangeEmailFormFactoryTest.php b/tests/ZfcUserTest/Factory/Form/ChangeEmailFormFactoryTest.php index e76b8f40..b7f4ca3f 100644 --- a/tests/ZfcUserTest/Factory/Form/ChangeEmailFormFactoryTest.php +++ b/tests/ZfcUserTest/Factory/Form/ChangeEmailFormFactoryTest.php @@ -1,8 +1,8 @@ getValidatorChain()->getValidators(); $this->assertArrayHasKey('instance', $validators[0]); - $this->assertInstanceOf('\Zend\Validator\EmailAddress', $validators[0]['instance']); + $this->assertInstanceOf('\Laminas\Validator\EmailAddress', $validators[0]['instance']); } /** @@ -52,7 +52,7 @@ public function testConstructIdentityEmail($onlyEmail) // test email as identity $validators = $identity->getValidatorChain()->getValidators(); $this->assertArrayHasKey('instance', $validators[0]); - $this->assertInstanceOf('\Zend\Validator\EmailAddress', $validators[0]['instance']); + $this->assertInstanceOf('\Laminas\Validator\EmailAddress', $validators[0]['instance']); } } diff --git a/tests/ZfcUserTest/Form/ChangePasswordFilterTest.php b/tests/ZfcUserTest/Form/ChangePasswordFilterTest.php index 5e4a1636..48f79887 100644 --- a/tests/ZfcUserTest/Form/ChangePasswordFilterTest.php +++ b/tests/ZfcUserTest/Form/ChangePasswordFilterTest.php @@ -23,7 +23,7 @@ public function testConstruct() $validators = $inputs['identity']->getValidatorChain()->getValidators(); $this->assertArrayHasKey('instance', $validators[0]); - $this->assertInstanceOf('\Zend\Validator\EmailAddress', $validators[0]['instance']); + $this->assertInstanceOf('\Laminas\Validator\EmailAddress', $validators[0]['instance']); } /** @@ -52,7 +52,7 @@ public function testConstructIdentityEmail($onlyEmail) // test email as identity $validators = $identity->getValidatorChain()->getValidators(); $this->assertArrayHasKey('instance', $validators[0]); - $this->assertInstanceOf('\Zend\Validator\EmailAddress', $validators[0]['instance']); + $this->assertInstanceOf('\Laminas\Validator\EmailAddress', $validators[0]['instance']); } } diff --git a/tests/ZfcUserTest/Form/LoginFilterTest.php b/tests/ZfcUserTest/Form/LoginFilterTest.php index afaf9304..2bce2e7c 100644 --- a/tests/ZfcUserTest/Form/LoginFilterTest.php +++ b/tests/ZfcUserTest/Form/LoginFilterTest.php @@ -46,6 +46,6 @@ public function testConstructIdentityEmail() // test email as identity $validators = $identity->getValidatorChain()->getValidators(); $this->assertArrayHasKey('instance', $validators[0]); - $this->assertInstanceOf('\Zend\Validator\EmailAddress', $validators[0]['instance']); + $this->assertInstanceOf('\Laminas\Validator\EmailAddress', $validators[0]['instance']); } } diff --git a/tests/ZfcUserTest/Form/RegisterTest.php b/tests/ZfcUserTest/Form/RegisterTest.php index 005920f8..498282a8 100644 --- a/tests/ZfcUserTest/Form/RegisterTest.php +++ b/tests/ZfcUserTest/Form/RegisterTest.php @@ -21,8 +21,8 @@ public function testConstruct($useCaptcha = false) $options->expects($this->any()) ->method('getUseRegistrationFormCaptcha') ->will($this->returnValue($useCaptcha)); - if ($useCaptcha && class_exists('\Zend\Captcha\AbstractAdapter')) { - $captcha = $this->getMockForAbstractClass('\Zend\Captcha\AbstractAdapter'); + if ($useCaptcha && class_exists('\Laminas\Captcha\AbstractAdapter')) { + $captcha = $this->getMockForAbstractClass('\Laminas\Captcha\AbstractAdapter'); $options->expects($this->once()) ->method('getFormCaptchaOptions') @@ -83,7 +83,7 @@ public function testSetCaptchaElement() ->method('getUseRegistrationFormCaptcha') ->will($this->returnValue(false)); - $captcha = $this->getMock('\Zend\Form\Element\Captcha'); + $captcha = $this->getMock('\Laminas\Form\Element\Captcha'); $form = new Form(null, $options); $form->setCaptchaElement($captcha); diff --git a/tests/ZfcUserTest/Mapper/UserTest.php b/tests/ZfcUserTest/Mapper/UserTest.php index 6b66c854..7ca4e37c 100644 --- a/tests/ZfcUserTest/Mapper/UserTest.php +++ b/tests/ZfcUserTest/Mapper/UserTest.php @@ -4,8 +4,8 @@ use ZfcUser\Mapper\User as Mapper; use ZfcUser\Entity\User as Entity; -use Zend\Db\ResultSet\HydratingResultSet; -use Zend\Db\Adapter\Adapter; +use Laminas\Db\ResultSet\HydratingResultSet; +use Laminas\Db\Adapter\Adapter; use ZfcUser\Mapper\UserHydrator; class UserTest extends \PHPUnit_Framework_TestCase @@ -13,25 +13,25 @@ class UserTest extends \PHPUnit_Framework_TestCase /** @var \ZfcUser\Mapper\User */ protected $mapper; - /** @var \Zend\Db\Adapter\Adapter */ + /** @var \Laminas\Db\Adapter\Adapter */ protected $mockedDbAdapter; - /** @var \Zend\Db\Adapter\Adapter */ + /** @var \Laminas\Db\Adapter\Adapter */ protected $realAdapter = array(); - /** @var \Zend\Db\Sql\Select */ + /** @var \Laminas\Db\Sql\Select */ protected $mockedSelect; - /** @var \Zend\Db\ResultSet\HydratingResultSet */ + /** @var \Laminas\Db\ResultSet\HydratingResultSet */ protected $mockedResultSet; - /** @var \Zend\Db\Sql\Sql */ + /** @var \Laminas\Db\Sql\Sql */ protected $mockedDbSql; - /** @var \Zend\Db\Adapter\Driver\DriverInterface */ + /** @var \Laminas\Db\Adapter\Driver\DriverInterface */ protected $mockedDbAdapterDriver; - /** @var \Zend\Db\Adapter\Platform\PlatformInterface */ + /** @var \Laminas\Db\Adapter\Platform\PlatformInterface */ protected $mockedDbAdapterPlatform; public function setUp() @@ -44,9 +44,9 @@ public function setUp() $this->setUpMockedAdapter(); - $this->mockedSelect = $this->getMock('\Zend\Db\Sql\Select', array('where')); + $this->mockedSelect = $this->getMock('\Laminas\Db\Sql\Select', array('where')); - $this->mockedResultSet = $this->getMock('\Zend\Db\ResultSet\HydratingResultSet'); + $this->mockedResultSet = $this->getMock('\Laminas\Db\ResultSet\HydratingResultSet'); $this->setUpAdapter('mysql'); // $this->setUpAdapter('pgsql'); @@ -105,15 +105,15 @@ public function setUpSqlDatabase($adapter, $schemaPath) */ public function setUpMockedAdapter() { - $this->mockedDbAdapterDriver = $this->getMock('Zend\Db\Adapter\Driver\DriverInterface'); - $this->mockedDbAdapterPlatform = $this->getMock('Zend\Db\Adapter\Platform\PlatformInterface', array()); - $this->mockedDbAdapterStatement= $this->getMock('Zend\Db\Adapter\Driver\StatementInterface', array()); + $this->mockedDbAdapterDriver = $this->getMock('Laminas\Db\Adapter\Driver\DriverInterface'); + $this->mockedDbAdapterPlatform = $this->getMock('Laminas\Db\Adapter\Platform\PlatformInterface', array()); + $this->mockedDbAdapterStatement= $this->getMock('Laminas\Db\Adapter\Driver\StatementInterface', array()); $this->mockedDbAdapterPlatform->expects($this->any()) ->method('getName') ->will($this->returnValue('null')); - $this->mockedDbAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') + $this->mockedDbAdapter = $this->getMockBuilder('Laminas\Db\Adapter\Adapter') ->setConstructorArgs(array( $this->mockedDbAdapterDriver, $this->mockedDbAdapterPlatform @@ -124,7 +124,7 @@ public function setUpMockedAdapter() ->method('getPlatform') ->will($this->returnValue($this->mockedDbAdapterPlatform)); - $this->mockedDbSql = $this->getMockBuilder('Zend\Db\Sql\Sql') + $this->mockedDbSql = $this->getMockBuilder('Laminas\Db\Sql\Sql') ->setConstructorArgs(array($this->mockedDbAdapter)) ->setMethods(array('prepareStatementForSqlObject')) ->getMock(); @@ -132,7 +132,7 @@ public function setUpMockedAdapter() ->method('prepareStatementForSqlObject') ->will($this->returnValue($this->mockedDbAdapterStatement)); - $this->mockedDbSqlPlatform = $this->getMockBuilder('\Zend\Db\Sql\Platform\Platform') + $this->mockedDbSqlPlatform = $this->getMockBuilder('\Laminas\Db\Sql\Platform\Platform') ->setConstructorArgs(array($this->mockedDbAdapter)) ->getMock(); } diff --git a/tests/ZfcUserTest/Service/UserTest.php b/tests/ZfcUserTest/Service/UserTest.php index f671542d..1a032664 100644 --- a/tests/ZfcUserTest/Service/UserTest.php +++ b/tests/ZfcUserTest/Service/UserTest.php @@ -3,7 +3,7 @@ namespace ZfcUserTest\Service; use ZfcUser\Service\User as Service; -use Zend\Crypt\Password\Bcrypt; +use Laminas\Crypt\Password\Bcrypt; class UserTest extends \PHPUnit_Framework_TestCase { @@ -29,19 +29,19 @@ public function setUp() $options = $this->getMock('ZfcUser\Options\ModuleOptions'); $this->options = $options; - $serviceManager = $this->getMock('Zend\ServiceManager\ServiceManager'); + $serviceManager = $this->getMock('Laminas\ServiceManager\ServiceManager'); $this->serviceManager = $serviceManager; - $eventManager = $this->getMock('Zend\EventManager\EventManager'); + $eventManager = $this->getMock('Laminas\EventManager\EventManager'); $this->eventManager = $eventManager; - $formHydrator = $this->getMock('Zend\Hydrator\HydratorInterface'); + $formHydrator = $this->getMock('Laminas\Hydrator\HydratorInterface'); $this->formHydrator = $formHydrator; $mapper = $this->getMock('ZfcUser\Mapper\UserInterface'); $this->mapper = $mapper; - $authService = $this->getMockBuilder('Zend\Authentication\AuthenticationService')->disableOriginalConstructor()->getMock(); + $authService = $this->getMockBuilder('Laminas\Authentication\AuthenticationService')->disableOriginalConstructor()->getMock(); $this->authService = $authService; $service->setOptions($options); @@ -458,7 +458,7 @@ public function testGetAuthService() $service = new Service; $service->setServiceManager($this->serviceManager); - $this->assertInstanceOf('Zend\Authentication\AuthenticationService', $service->getAuthService()); + $this->assertInstanceOf('Laminas\Authentication\AuthenticationService', $service->getAuthService()); } /** @@ -576,7 +576,7 @@ public function testGetFormHydrator() $service = new Service; $service->setServiceManager($this->serviceManager); - $this->assertInstanceOf('Zend\Hydrator\HydratorInterface', $service->getFormHydrator()); + $this->assertInstanceOf('Laminas\Hydrator\HydratorInterface', $service->getFormHydrator()); } /** diff --git a/tests/ZfcUserTest/View/Helper/ZfcUserDisplayNameTest.php b/tests/ZfcUserTest/View/Helper/ZfcUserDisplayNameTest.php index 5027ac0e..d4a590a0 100644 --- a/tests/ZfcUserTest/View/Helper/ZfcUserDisplayNameTest.php +++ b/tests/ZfcUserTest/View/Helper/ZfcUserDisplayNameTest.php @@ -17,7 +17,7 @@ public function setUp() $helper = new ViewHelper; $this->helper = $helper; - $authService = $this->getMock('Zend\Authentication\AuthenticationService'); + $authService = $this->getMock('Laminas\Authentication\AuthenticationService'); $this->authService = $authService; $user = $this->getMock('ZfcUser\Entity\User'); diff --git a/tests/ZfcUserTest/View/Helper/ZfcUserIdentityTest.php b/tests/ZfcUserTest/View/Helper/ZfcUserIdentityTest.php index d8d95d30..59b5aaf8 100644 --- a/tests/ZfcUserTest/View/Helper/ZfcUserIdentityTest.php +++ b/tests/ZfcUserTest/View/Helper/ZfcUserIdentityTest.php @@ -15,7 +15,7 @@ public function setUp() $helper = new ViewHelper; $this->helper = $helper; - $authService = $this->getMock('Zend\Authentication\AuthenticationService'); + $authService = $this->getMock('Laminas\Authentication\AuthenticationService'); $this->authService = $authService; $helper->setAuthService($authService); diff --git a/tests/ZfcUserTest/View/Helper/ZfcUserLoginWidgetTest.php b/tests/ZfcUserTest/View/Helper/ZfcUserLoginWidgetTest.php index 58df9fda..9bdafb88 100644 --- a/tests/ZfcUserTest/View/Helper/ZfcUserLoginWidgetTest.php +++ b/tests/ZfcUserTest/View/Helper/ZfcUserLoginWidgetTest.php @@ -3,7 +3,7 @@ namespace ZfcUserTest\View\Helper; use ZfcUser\View\Helper\ZfcUserLoginWidget as ViewHelper; -use Zend\View\Model\ViewModel; +use Laminas\View\Model\ViewModel; class ZfcUserLoginWidgetTest extends \PHPUnit_Framework_TestCase { @@ -15,7 +15,7 @@ public function setUp() { $this->helper = new ViewHelper; - $view = $this->getMock('Zend\View\Renderer\RendererInterface'); + $view = $this->getMock('Laminas\View\Renderer\RendererInterface'); $this->view = $view; $this->helper->setView($view); @@ -63,7 +63,7 @@ public function providerTestInvokeWithRender() public function testInvokeWithRender($option, $expect) { /** - * @var $viewModel \Zend\View\Model\ViewModels + * @var $viewModel \Laminas\View\Model\ViewModels */ $viewModel = null; @@ -76,11 +76,11 @@ public function testInvokeWithRender($option, $expect) $result = $this->helper->__invoke($option); - $this->assertNotInstanceOf('Zend\View\Model\ViewModel', $result); + $this->assertNotInstanceOf('Laminas\View\Model\ViewModel', $result); $this->assertInternalType('string', $result); - $this->assertInstanceOf('Zend\View\Model\ViewModel', $viewModel); + $this->assertInstanceOf('Laminas\View\Model\ViewModel', $viewModel); foreach ($expect as $name => $value) { $this->assertEquals($value, $viewModel->getVariable($name, "testDefault")); } @@ -96,7 +96,7 @@ public function testInvokeWithoutRender() 'redirect' => 'zfcUser' )); - $this->assertInstanceOf('Zend\View\Model\ViewModel', $result); + $this->assertInstanceOf('Laminas\View\Model\ViewModel', $result); $this->assertEquals('zfcUser', $result->redirect); } diff --git a/view/zfc-user/user/_form.phtml b/view/zfc-user/user/_form.phtml index 2a33fbb5..5e0a882d 100644 --- a/view/zfc-user/user/_form.phtml +++ b/view/zfc-user/user/_form.phtml @@ -1,7 +1,7 @@ form()->openTag($form) ?>
- getLabel() != null && !$element instanceof Zend\Form\Element\Button) : ?> + getLabel() != null && !$element instanceof Laminas\Form\Element\Button) : ?>
formLabel($element) ?>
formElement($element) . $this->formElementErrors($element) ?>
From 4f61e4cb29599ba5b266b9252aa097ced0579bd4 Mon Sep 17 00:00:00 2001 From: Alex Lampret Date: Tue, 22 Dec 2020 13:05:05 +0100 Subject: [PATCH 11/11] Update UserInterface.php --- src/ZfcUser/Entity/UserInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ZfcUser/Entity/UserInterface.php b/src/ZfcUser/Entity/UserInterface.php index 2fbe1cd1..d6749d35 100644 --- a/src/ZfcUser/Entity/UserInterface.php +++ b/src/ZfcUser/Entity/UserInterface.php @@ -67,14 +67,14 @@ public function setDisplayName($displayName); /** * Get password. * - * @return string password + * @return string|null password */ public function getPassword(); /** * Set password. * - * @param string $password + * @param string|null $password * @return UserInterface */ public function setPassword($password);