Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
runSessionOnKernelResponse example
public
function
testUserProvidersNeedToImplementAnInterface
(
)
{
$this
->
expectException
(
\InvalidArgumentException::
class
)
;
$this
->
expectExceptionMessage
(
'User provider "stdClass" must implement "Symfony\Component\Security\Core\User\UserProviderInterface'
)
;
$this
->
handleEventWithPreviousSession
(
[
new
\
stdClass
(
)
]
)
;
}
public
function
testOnKernelResponseWillAddSession
(
)
{
$session
=
$this
->
runSessionOnKernelResponse
(
new
UsernamePasswordToken
(
new
InMemoryUser
(
'test1', 'pass1'
)
, 'phpunit',
[
'ROLE_USER'
]
)
,
null
)
;
$token
=
unserialize
(
$session
->
get
(
'_security_session'
)
)
;
$this
->
assertInstanceOf
(
UsernamePasswordToken::
class
,
$token
)
;
$this
->
assertEquals
(
'test1',
$token
->
getUserIdentifier
(
)
)
;
}
public
function
testOnKernelResponseWillReplaceSession
(
)
{