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 @@
...
@@ -2,14 +2,14 @@
namespace
ZfcUserTest\Controller
;
namespace
ZfcUserTest\Controller
;
use
Zend
\Form\FormElementManager
;
use
Laminas
\Form\FormElementManager
;
use
ZfcUser\Controller\RedirectCallback
;
use
ZfcUser\Controller\RedirectCallback
;
use
ZfcUser\Controller\UserController
as
Controller
;
use
ZfcUser\Controller\UserController
as
Controller
;
use
Zend
\Http\Response
;
use
Laminas
\Http\Response
;
use
Zend
\Stdlib\Parameters
;
use
Laminas
\Stdlib\Parameters
;
use
Zend
\ServiceManager\ServiceLocatorInterface
;
use
Laminas
\ServiceManager\ServiceLocatorInterface
;
use
ZfcUser\Service\User
as
UserService
;
use
ZfcUser\Service\User
as
UserService
;
use
Zend
\Form\Form
;
use
Laminas
\Form\Form
;
use
ZfcUser\Options\ModuleOptions
;
use
ZfcUser\Options\ModuleOptions
;
use
ZfcUser\Entity\User
as
UserIdentity
;
use
ZfcUser\Entity\User
as
UserIdentity
;
...
@@ -44,7 +44,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -44,7 +44,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$this
->
zfcUserAuthenticationPlugin
=
$this
->
getMock
(
'ZfcUser\Controller\Plugin\ZfcUserAuthentication'
);
$this
->
zfcUserAuthenticationPlugin
=
$this
->
getMock
(
'ZfcUser\Controller\Plugin\ZfcUserAuthentication'
);
$pluginManager
=
$this
->
getMockBuilder
(
'
Zend
\Mvc\Controller\PluginManager'
)
$pluginManager
=
$this
->
getMockBuilder
(
'
Laminas
\Mvc\Controller\PluginManager'
)
->
disableOriginalConstructor
()
->
disableOriginalConstructor
()
->
getMock
();
->
getMock
();
...
@@ -117,7 +117,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -117,7 +117,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
will
(
$this
->
returnValue
(
$redirectRoute
));
->
will
(
$this
->
returnValue
(
$redirectRoute
));
}
}
$redirect
=
$this
->
getMock
(
'
Zend
\Mvc\Controller\Plugin\Redirect'
);
$redirect
=
$this
->
getMock
(
'
Laminas
\Mvc\Controller\Plugin\Redirect'
);
$redirect
->
expects
(
$this
->
once
())
$redirect
->
expects
(
$this
->
once
())
->
method
(
'toRoute'
)
->
method
(
'toRoute'
)
->
with
(
$redirectRoute
)
->
with
(
$redirectRoute
)
...
@@ -127,7 +127,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -127,7 +127,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$result
=
call_user_func
(
array
(
$controller
,
$methodeName
));
$result
=
call_user_func
(
array
(
$controller
,
$methodeName
));
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
}
}
...
@@ -143,7 +143,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -143,7 +143,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$result
=
$controller
->
indexAction
();
$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
...
@@ -161,7 +161,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
));
));
$flashMessenger
=
$this
->
getMock
(
$flashMessenger
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
);
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
...
@@ -175,7 +175,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -175,7 +175,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
will
(
$this
->
returnSelf
());
->
will
(
$this
->
returnSelf
());
$postArray
=
array
(
'some'
,
'data'
);
$postArray
=
array
(
'some'
,
'data'
);
$request
=
$this
->
getMock
(
'
Zend
\Http\Request'
);
$request
=
$this
->
getMock
(
'
Laminas
\Http\Request'
);
$request
->
expects
(
$this
->
any
())
$request
->
expects
(
$this
->
any
())
->
method
(
'isPost'
)
->
method
(
'isPost'
)
->
will
(
$this
->
returnValue
(
true
));
->
will
(
$this
->
returnValue
(
true
));
...
@@ -211,7 +211,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -211,7 +211,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$adapter
->
expects
(
$this
->
once
())
$adapter
->
expects
(
$this
->
once
())
->
method
(
'resetAdapters'
);
->
method
(
'resetAdapters'
);
$service
=
$this
->
getMock
(
'
Zend
\Authentication\AuthenticationService'
);
$service
=
$this
->
getMock
(
'
Laminas
\Authentication\AuthenticationService'
);
$service
->
expects
(
$this
->
once
())
$service
->
expects
(
$this
->
once
())
->
method
(
'clearIdentity'
);
->
method
(
'clearIdentity'
);
...
@@ -226,7 +226,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -226,7 +226,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$expectedResult
=
new
\
stdClass
();
$expectedResult
=
new
\
stdClass
();
$forwardPlugin
=
$this
->
getMockBuilder
(
'
Zend
\Mvc\Controller\Plugin\Forward'
)
$forwardPlugin
=
$this
->
getMockBuilder
(
'
Laminas
\Mvc\Controller\Plugin\Forward'
)
->
disableOriginalConstructor
()
->
disableOriginalConstructor
()
->
getMock
();
->
getMock
();
$forwardPlugin
->
expects
(
$this
->
once
())
$forwardPlugin
->
expects
(
$this
->
once
())
...
@@ -242,7 +242,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -242,7 +242,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$route_url
=
"/user/login"
;
$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
())
$redirect
->
expects
(
$this
->
any
())
->
method
(
'toUrl'
)
->
method
(
'toUrl'
)
->
with
(
$route_url
.
$redirectQuery
)
->
with
(
$route_url
.
$redirectQuery
)
...
@@ -257,7 +257,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -257,7 +257,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$response
=
new
Response
();
$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
())
$url
->
expects
(
$this
->
once
())
->
method
(
'fromRoute'
)
->
method
(
'fromRoute'
)
->
with
(
$controller
::
ROUTE_LOGIN
)
->
with
(
$controller
::
ROUTE_LOGIN
)
...
@@ -274,7 +274,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -274,7 +274,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
if
(
$isValid
)
{
if
(
$isValid
)
{
$this
->
assertSame
(
$expectedResult
,
$result
);
$this
->
assertSame
(
$expectedResult
,
$result
);
}
else
{
}
else
{
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertEquals
(
$response
,
$result
);
$this
->
assertEquals
(
$response
,
$result
);
$this
->
assertEquals
(
$route_url
.
$redirectQuery
,
$result
->
getHeaders
()
->
get
(
'Location'
)
->
getFieldValue
());
$this
->
assertEquals
(
$route_url
.
$redirectQuery
,
$result
->
getHeaders
()
->
get
(
'Location'
)
->
getFieldValue
());
}
}
...
@@ -290,11 +290,11 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -290,11 +290,11 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
'hasIdentity'
=>
false
'hasIdentity'
=>
false
));
));
$flashMessenger
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
$flashMessenger
=
$this
->
getMock
(
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
$request
=
$this
->
getMock
(
'
Zend
\Http\Request'
);
$request
=
$this
->
getMock
(
'
Laminas
\Http\Request'
);
$request
->
expects
(
$this
->
once
())
$request
->
expects
(
$this
->
once
())
->
method
(
'isPost'
)
->
method
(
'isPost'
)
->
will
(
$this
->
returnValue
(
false
));
->
will
(
$this
->
returnValue
(
false
));
...
@@ -354,7 +354,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -354,7 +354,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$adapter
->
expects
(
$this
->
once
())
$adapter
->
expects
(
$this
->
once
())
->
method
(
'logoutAdapters'
);
->
method
(
'logoutAdapters'
);
$service
=
$this
->
getMock
(
'
Zend
\Authentication\AuthenticationService'
);
$service
=
$this
->
getMock
(
'
Laminas
\Authentication\AuthenticationService'
);
$service
->
expects
(
$this
->
once
())
$service
->
expects
(
$this
->
once
())
->
method
(
'clearIdentity'
);
->
method
(
'clearIdentity'
);
...
@@ -372,7 +372,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -372,7 +372,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$result
=
$controller
->
logoutAction
();
$result
=
$controller
->
logoutAction
();
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
}
}
...
@@ -391,7 +391,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -391,7 +391,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$response
=
new
Response
();
$response
=
new
Response
();
$hasRedirect
=
!
(
is_null
(
$query
)
&&
is_null
(
$post
));
$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
())
$params
->
expects
(
$this
->
any
())
->
method
(
'__invoke'
)
->
method
(
'__invoke'
)
->
will
(
$this
->
returnSelf
());
->
will
(
$this
->
returnSelf
());
...
@@ -408,7 +408,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -408,7 +408,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$this
->
pluginManagerPlugins
[
'params'
]
=
$params
;
$this
->
pluginManagerPlugins
[
'params'
]
=
$params
;
$request
=
$this
->
getMock
(
'
Zend
\Http\Request'
);
$request
=
$this
->
getMock
(
'
Laminas
\Http\Request'
);
$this
->
helperMakePropertyAccessable
(
$controller
,
'request'
,
$request
);
$this
->
helperMakePropertyAccessable
(
$controller
,
'request'
,
$request
);
...
@@ -418,7 +418,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -418,7 +418,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
with
(
$request
)
->
with
(
$request
)
->
will
(
$this
->
returnValue
(
$prepareResult
));
->
will
(
$this
->
returnValue
(
$prepareResult
));
$service
=
$this
->
getMock
(
'
Zend
\Authentication\AuthenticationService'
);
$service
=
$this
->
getMock
(
'
Laminas
\Authentication\AuthenticationService'
);
$this
->
setUpZfcUserAuthenticationPlugin
(
array
(
$this
->
setUpZfcUserAuthenticationPlugin
(
array
(
...
@@ -428,7 +428,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -428,7 +428,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
));
));
if
(
is_bool
(
$prepareResult
))
{
if
(
is_bool
(
$prepareResult
))
{
$authResult
=
$this
->
getMockBuilder
(
'
Zend
\Authentication\Result'
)
$authResult
=
$this
->
getMockBuilder
(
'
Laminas
\Authentication\Result'
)
->
disableOriginalConstructor
()
->
disableOriginalConstructor
()
->
getMock
();
->
getMock
();
$authResult
->
expects
(
$this
->
once
())
$authResult
->
expects
(
$this
->
once
())
...
@@ -440,12 +440,12 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -440,12 +440,12 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
with
(
$adapter
)
->
with
(
$adapter
)
->
will
(
$this
->
returnValue
(
$authResult
));
->
will
(
$this
->
returnValue
(
$authResult
));
$redirect
=
$this
->
getMock
(
'
Zend
\Mvc\Controller\Plugin\Redirect'
);
$redirect
=
$this
->
getMock
(
'
Laminas
\Mvc\Controller\Plugin\Redirect'
);
$this
->
pluginManagerPlugins
[
'redirect'
]
=
$redirect
;
$this
->
pluginManagerPlugins
[
'redirect'
]
=
$redirect
;
if
(
!
$authValid
)
{
if
(
!
$authValid
)
{
$flashMessenger
=
$this
->
getMock
(
$flashMessenger
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
);
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
...
@@ -468,7 +468,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -468,7 +468,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
with
(
'user/login'
.
$redirectQuery
)
->
with
(
'user/login'
.
$redirectQuery
)
->
will
(
$this
->
returnValue
(
$response
));
->
will
(
$this
->
returnValue
(
$response
));
$url
=
$this
->
getMock
(
'
Zend
\Mvc\Controller\Plugin\Url'
);
$url
=
$this
->
getMock
(
'
Laminas
\Mvc\Controller\Plugin\Url'
);
$url
->
expects
(
$this
->
once
())
$url
->
expects
(
$this
->
once
())
->
method
(
'fromRoute'
)
->
method
(
'fromRoute'
)
->
with
(
$controller
::
ROUTE_LOGIN
)
->
with
(
$controller
::
ROUTE_LOGIN
)
...
@@ -533,13 +533,13 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -533,13 +533,13 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
method
(
'getEnableRegistration'
)
->
method
(
'getEnableRegistration'
)
->
will
(
$this
->
returnValue
(
true
));
->
will
(
$this
->
returnValue
(
true
));
$request
=
$this
->
getMock
(
'
Zend
\Http\Request'
);
$request
=
$this
->
getMock
(
'
Laminas
\Http\Request'
);
$this
->
helperMakePropertyAccessable
(
$controller
,
'request'
,
$request
);
$this
->
helperMakePropertyAccessable
(
$controller
,
'request'
,
$request
);
$userService
=
$this
->
getMock
(
'ZfcUser\Service\User'
);
$userService
=
$this
->
getMock
(
'ZfcUser\Service\User'
);
$controller
->
setUserService
(
$userService
);
$controller
->
setUserService
(
$userService
);
$form
=
$this
->
getMockBuilder
(
'
Zend
\Form\Form'
)
$form
=
$this
->
getMockBuilder
(
'
Laminas
\Form\Form'
)
->
disableOriginalConstructor
()
->
disableOriginalConstructor
()
->
getMock
();
->
getMock
();
...
@@ -559,7 +559,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -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
))
$url
->
expects
(
$this
->
at
(
0
))
->
method
(
'fromRoute'
)
->
method
(
'fromRoute'
)
->
with
(
$controller
::
ROUTE_REGISTER
)
->
with
(
$controller
::
ROUTE_REGISTER
)
...
@@ -567,7 +567,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -567,7 +567,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$this
->
pluginManagerPlugins
[
'url'
]
=
$url
;
$this
->
pluginManagerPlugins
[
'url'
]
=
$url
;
$prg
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\Prg\PostRedirectGet'
);
$prg
=
$this
->
getMock
(
'
Laminas
\Mvc\Plugin\Prg\PostRedirectGet'
);
$this
->
pluginManagerPlugins
[
'prg'
]
=
$prg
;
$this
->
pluginManagerPlugins
[
'prg'
]
=
$prg
;
$redirectQuery
=
$wantRedirect
?
'?redirect='
.
rawurlencode
(
$redirectUrl
)
:
''
;
$redirectQuery
=
$wantRedirect
?
'?redirect='
.
rawurlencode
(
$redirectUrl
)
:
''
;
...
@@ -601,7 +601,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -601,7 +601,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$expectedResult
=
new
\
stdClass
();
$expectedResult
=
new
\
stdClass
();
$forwardPlugin
=
$this
->
getMockBuilder
(
'
Zend
\Mvc\Controller\Plugin\Forward'
)
$forwardPlugin
=
$this
->
getMockBuilder
(
'
Laminas
\Mvc\Controller\Plugin\Forward'
)
->
disableOriginalConstructor
()
->
disableOriginalConstructor
()
->
getMock
();
->
getMock
();
$forwardPlugin
->
expects
(
$this
->
once
())
$forwardPlugin
->
expects
(
$this
->
once
())
...
@@ -620,7 +620,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -620,7 +620,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$redirectQuery
=
$redirectUrl
?
'?redirect='
.
rawurlencode
(
$redirectUrl
)
:
''
;
$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
())
$redirect
->
expects
(
$this
->
once
())
->
method
(
'toUrl'
)
->
method
(
'toUrl'
)
->
with
(
$route_url
.
$redirectQuery
)
->
with
(
$route_url
.
$redirectQuery
)
...
@@ -673,7 +673,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -673,7 +673,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$this
->
assertArrayHasKey
(
'redirect'
,
$result
);
$this
->
assertArrayHasKey
(
'redirect'
,
$result
);
$this
->
assertEquals
(
$expectedResult
,
$result
);
$this
->
assertEquals
(
$expectedResult
,
$result
);
}
else
{
}
else
{
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
}
}
}
}
...
@@ -692,7 +692,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -692,7 +692,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
'hasIdentity'
=>
true
'hasIdentity'
=>
true
));
));
$form
=
$this
->
getMockBuilder
(
'
Zend
\Form\Form'
)
$form
=
$this
->
getMockBuilder
(
'
Laminas
\Form\Form'
)
->
disableOriginalConstructor
()
->
disableOriginalConstructor
()
->
getMock
();
->
getMock
();
...
@@ -701,7 +701,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -701,7 +701,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$flashMessenger
=
$this
->
getMock
(
$flashMessenger
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
);
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
...
@@ -715,7 +715,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -715,7 +715,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
will
(
$this
->
returnValue
(
$status
?
array
(
'test'
)
:
array
()));
->
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
;
$this
->
pluginManagerPlugins
[
'prg'
]
=
$prg
;
...
@@ -754,7 +754,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -754,7 +754,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
with
(
true
);
->
with
(
true
);
$redirect
=
$this
->
getMock
(
'
Zend
\Mvc\Controller\Plugin\Redirect'
);
$redirect
=
$this
->
getMock
(
'
Laminas
\Mvc\Controller\Plugin\Redirect'
);
$redirect
->
expects
(
$this
->
once
())
$redirect
->
expects
(
$this
->
once
())
->
method
(
'toRoute'
)
->
method
(
'toRoute'
)
->
with
(
$controller
::
ROUTE_CHANGEPASSWD
)
->
with
(
$controller
::
ROUTE_CHANGEPASSWD
)
...
@@ -770,7 +770,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -770,7 +770,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$exceptedReturn
=
null
;
$exceptedReturn
=
null
;
if
(
$postRedirectGetReturn
instanceof
Response
)
{
if
(
$postRedirectGetReturn
instanceof
Response
)
{
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertSame
(
$postRedirectGetReturn
,
$result
);
$this
->
assertSame
(
$postRedirectGetReturn
,
$result
);
}
else
{
}
else
{
if
(
$postRedirectGetReturn
===
false
)
{
if
(
$postRedirectGetReturn
===
false
)
{
...
@@ -790,7 +790,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -790,7 +790,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$this
->
assertArrayHasKey
(
'changePasswordForm'
,
$result
);
$this
->
assertArrayHasKey
(
'changePasswordForm'
,
$result
);
$this
->
assertEquals
(
$exceptedReturn
,
$result
);
$this
->
assertEquals
(
$exceptedReturn
,
$result
);
}
else
{
}
else
{
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
}
}
}
}
...
@@ -806,7 +806,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -806,7 +806,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$controller
=
$this
->
controller
;
$controller
=
$this
->
controller
;
$response
=
new
Response
();
$response
=
new
Response
();
$userService
=
$this
->
getMock
(
'ZfcUser\Service\User'
);
$userService
=
$this
->
getMock
(
'ZfcUser\Service\User'
);
$authService
=
$this
->
getMock
(
'
Zend
\Authentication\AuthenticationService'
);
$authService
=
$this
->
getMock
(
'
Laminas
\Authentication\AuthenticationService'
);
$identity
=
new
UserIdentity
();
$identity
=
new
UserIdentity
();
$controller
->
setUserService
(
$userService
);
$controller
->
setUserService
(
$userService
);
...
@@ -815,7 +815,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -815,7 +815,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
'hasIdentity'
=>
true
'hasIdentity'
=>
true
));
));
$form
=
$this
->
getMockBuilder
(
'
Zend
\Form\Form'
)
$form
=
$this
->
getMockBuilder
(
'
Laminas
\Form\Form'
)
->
disableOriginalConstructor
()
->
disableOriginalConstructor
()
->
getMock
();
->
getMock
();
...
@@ -831,12 +831,12 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -831,12 +831,12 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$identity
->
setEmail
(
'user@example.com'
);
$identity
->
setEmail
(
'user@example.com'
);
$requestParams
=
$this
->
getMock
(
'
Zend
\Stdlib\Parameters'
);
$requestParams
=
$this
->
getMock
(
'
Laminas
\Stdlib\Parameters'
);
$requestParams
->
expects
(
$this
->
once
())
$requestParams
->
expects
(
$this
->
once
())
->
method
(
'set'
)
->
method
(
'set'
)
->
with
(
'identity'
,
$identity
->
getEmail
());
->
with
(
'identity'
,
$identity
->
getEmail
());
$request
=
$this
->
getMock
(
'
Zend
\Http\Request'
);
$request
=
$this
->
getMock
(
'
Laminas
\Http\Request'
);
$request
->
expects
(
$this
->
once
())
$request
->
expects
(
$this
->
once
())
->
method
(
'getPost'
)
->
method
(
'getPost'
)
->
will
(
$this
->
returnValue
(
$requestParams
));
->
will
(
$this
->
returnValue
(
$requestParams
));
...
@@ -845,7 +845,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -845,7 +845,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$flashMessenger
=
$this
->
getMock
(
$flashMessenger
=
$this
->
getMock
(
'
Zend
\Mvc\Plugin\FlashMessenger\FlashMessenger'
'
Laminas
\Mvc\Plugin\FlashMessenger\FlashMessenger'
);
);
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
$this
->
pluginManagerPlugins
[
'flashMessenger'
]
=
$flashMessenger
;
...
@@ -859,7 +859,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -859,7 +859,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
will
(
$this
->
returnValue
(
$status
?
array
(
'test'
)
:
array
()));
->
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
;
$this
->
pluginManagerPlugins
[
'prg'
]
=
$prg
;
...
@@ -890,7 +890,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -890,7 +890,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
->
with
(
true
);
->
with
(
true
);
$redirect
=
$this
->
getMock
(
'
Zend
\Mvc\Controller\Plugin\Redirect'
);
$redirect
=
$this
->
getMock
(
'
Laminas
\Mvc\Controller\Plugin\Redirect'
);
$redirect
->
expects
(
$this
->
once
())
$redirect
->
expects
(
$this
->
once
())
->
method
(
'toRoute'
)
->
method
(
'toRoute'
)
->
with
(
$controller
::
ROUTE_CHANGEEMAIL
)
->
with
(
$controller
::
ROUTE_CHANGEEMAIL
)
...
@@ -910,7 +910,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -910,7 +910,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$exceptedReturn
=
null
;
$exceptedReturn
=
null
;
if
(
$postRedirectGetReturn
instanceof
Response
)
{
if
(
$postRedirectGetReturn
instanceof
Response
)
{
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertSame
(
$postRedirectGetReturn
,
$result
);
$this
->
assertSame
(
$postRedirectGetReturn
,
$result
);
}
else
{
}
else
{
if
(
$postRedirectGetReturn
===
false
)
{
if
(
$postRedirectGetReturn
===
false
)
{
...
@@ -931,7 +931,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
...
@@ -931,7 +931,7 @@ class UserControllerTest extends \PHPUnit_Framework_TestCase
$this
->
assertArrayHasKey
(
'changeEmailForm'
,
$result
);
$this
->
assertArrayHasKey
(
'changeEmailForm'
,
$result
);
$this
->
assertEquals
(
$exceptedReturn
,
$result
);
$this
->
assertEquals
(
$exceptedReturn
,
$result
);
}
else
{
}
else
{
$this
->
assertInstanceOf
(
'
Zend
\Http\Response'
,
$result
);
$this
->
assertInstanceOf
(
'
Laminas
\Http\Response'
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
$this
->
assertSame
(
$response
,
$result
);
}
}
}