Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
zfc-user
Commits
e699144c
Commit
e699144c
authored
Jul 13, 2021
by
Bertrand Gauthier
Browse files
laminas-migration migrate
parent
4c578763
Pipeline
#10459
passed with stage
in 21 seconds
Changes
75
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/ZfcUserTest/Controller/UserControllerTest.php
View file @
e699144c
...
...
@@ -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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$result
=
$controller
->
indexAction
();
$this
->
assertInstanceOf
(
'
Zend
\View\Model\ViewModel'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\View\Model\ViewModel'
,
$result
);
}
...
...
@@ -161,7 +161,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
));
$flashMessenger
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
...
...
@@ -175,7 +175,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
'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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$result
=
$controller
->
logoutAction
();
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
}
...
...
@@ -391,7 +391,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
));
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
}
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
'hasIdentity'
=>
true
));
$form
=
$this
->
getMockBuilder
(
'
Zend
\Form\Form'
)
$form
=
$this
->
getMockBuilder
(
'
Laminas
\Form\Form'
)
->
disableOriginalConstructor
()
->
getMock
();
...
...
@@ -701,7 +701,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$flashMessenger
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
...
...
@@ -715,7 +715,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
'hasIdentity'
=>
true
));
$form
=
$this
->
getMockBuilder
(
'
Zend
\Form\Form'
)
$form
=
$this
->
getMockBuilder
(
'
Laminas
\Form\Form'
)
->
disableOriginalConstructor
()
->
getMock
();
...
...
@@ -831,12 +831,12 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$flashMessenger
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
...
...
@@ -859,7 +859,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
}
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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
};
$loginFormCallback
[]
=
function
(
$that
,
$controller
)
{
$flashMessenger
=
$that
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
$that
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
...
...
tests/ZfcUserTest/Factory/Form/ChangeEmailFormFactoryTest.php
View file @
e699144c
<?php
namespace
ZfcUserTest\Factory\Form
;
use
Zend
\Form\FormElementManager
;
use
Zend
\ServiceManager\ServiceManager
;
use
Laminas
\Form\FormElementManager
;
use
Laminas
\ServiceManager\ServiceManager
;
use
ZfcUser\Factory\Form\ChangeEmail
as
ChangeEmailFactory
;
use
ZfcUser\Options\ModuleOptions
;
use
ZfcUser\Mapper\User
as
UserMapper
;
...
...
tests/ZfcUserTest/Factory/Form/ChangePasswordFormFactoryTest.php
View file @
e699144c
<?php
namespace
ZfcUserTest\Factory\Form
;
use
Zend
\Form\FormElementManager
;
use
Zend
\ServiceManager\ServiceManager
;
use
Laminas
\Form\FormElementManager
;
use
Laminas
\ServiceManager\ServiceManager
;
use
ZfcUser\Factory\Form\ChangePassword
as
ChangePasswordFactory
;
use
ZfcUser\Options\ModuleOptions
;
use
ZfcUser\Mapper\User
as
UserMapper
;
...
...
tests/ZfcUserTest/Factory/Form/LoginFormFactoryTest.php
View file @
e699144c
<?php
namespace
ZfcUserTest\Factory\Form
;
use
Zend
\Form\FormElementManager
;
use
Zend
\ServiceManager\ServiceManager
;
use
Laminas
\Form\FormElementManager
;
use
Laminas
\ServiceManager\ServiceManager
;
use
ZfcUser\Factory\Form\Login
as
LoginFactory
;
use
ZfcUser\Options\ModuleOptions
;
...
...
tests/ZfcUserTest/Factory/Form/RegisterFormFactoryTest.php
View file @
e699144c
<?php
namespace
ZfcUserTest\Factory\Form
;
use
Zend
\Form\FormElementManager
;
use
Zend
\ServiceManager\ServiceManager
;
use
Zend
\Hydrator\ClassMethods
;
use
Laminas
\Form\FormElementManager
;
use
Laminas
\ServiceManager\ServiceManager
;
use
Laminas
\Hydrator\ClassMethods
;
use
ZfcUser\Factory\Form\Register
as
RegisterFactory
;
use
ZfcUser\Options\ModuleOptions
;
use
ZfcUser\Mapper\User
as
UserMapper
;
...
...
tests/ZfcUserTest/Form/ChangeEmailFilterTest.php
View file @
e699144c
...
...
@@ -23,7 +23,7 @@ class ChangeEmailFilterTest extends \PHPUnit_Framework_TestCase
$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 @@ class ChangeEmailFilterTest extends \PHPUnit_Framework_TestCase
// 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'
]);
}
}
...
...
tests/ZfcUserTest/Form/ChangePasswordFilterTest.php
View file @
e699144c
...
...
@@ -23,7 +23,7 @@ class ChangePasswordFilterTest extends \PHPUnit_Framework_TestCase
$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 @@ class ChangePasswordFilterTest extends \PHPUnit_Framework_TestCase
// 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'
]);
}
}
...
...
tests/ZfcUserTest/Form/LoginFilterTest.php
View file @
e699144c
...
...
@@ -46,6 +46,6 @@ class LoginFilterTest extends \PHPUnit_Framework_TestCase
// 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'
]);
}
}
tests/ZfcUserTest/Form/RegisterTest.php
View file @
e699144c
...
...
@@ -21,8 +21,8 @@ class RegisterTest extends \PHPUnit_Framework_TestCase
$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 @@ class RegisterTest extends \PHPUnit_Framework_TestCase
->
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
);
...
...
tests/ZfcUserTest/Mapper/UserTest.php
View file @
e699144c
...
...
@@ -4,8 +4,8 @@ namespace ZfcUserTest\Mapper;
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 @@ class UserTest extends \PHPUnit_Framework_TestCase
$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 @@ class UserTest extends \PHPUnit_Framework_TestCase
*/
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
,