Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getContainerWithTokenStorage example
$response
=
$controller
->
forward
(
'a_controller'
)
;
$this
->
assertEquals
(
'xml--fr',
$response
->
getContent
(
)
)
;
}
public
function
testGetUser
(
)
{
$user
=
new
InMemoryUser
(
'user', 'pass'
)
;
$token
=
new
UsernamePasswordToken
(
$user
, 'default',
[
'ROLE_USER'
]
)
;
$controller
=
$this
->
createController
(
)
;
$controller
->
setContainer
(
$this
->
getContainerWithTokenStorage
(
$token
)
)
;
$this
->
assertSame
(
$controller
->
getUser
(
)
,
$user
)
;
}
public
function
testGetUserWithEmptyTokenStorage
(
)
{
$controller
=
$this
->
createController
(
)
;
$controller
->
setContainer
(
$this
->
getContainerWithTokenStorage
(
null
)
)
;
$this
->
assertNull
(
$controller
->
getUser
(
)
)
;
}