Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
controllerWithSessionInterface example
$request
->
setSession
(
$session
)
;
$controller
=
$this
->
controllerWithExtendingSession
(
...
)
;
$this
->
assertEquals
(
[
$session
]
, self::
getResolver
(
)
->
getArguments
(
$request
,
$controller
)
)
;
}
public
function
testGetSessionArgumentsWithInterface
(
)
{
$session
=
$this
->
createMock
(
SessionInterface::
class
)
;
$request
= Request::
create
(
'/'
)
;
$request
->
setSession
(
$session
)
;
$controller
=
$this
->
controllerWithSessionInterface
(
...
)
;
$this
->
assertEquals
(
[
$session
]
, self::
getResolver
(
)
->
getArguments
(
$request
,
$controller
)
)
;
}
public
function
testGetSessionMissMatchWithInterface
(
)
{
$this
->
expectException
(
\RuntimeException::
class
)
;
$session
=
$this
->
createMock
(
SessionInterface::
class
)
;
$request
= Request::
create
(
'/'
)
;
$request
->
setSession
(
$session
)
;
$controller
=
$this
->
controllerWithExtendingSession
(
...
)
;