Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
controllerWithFooAndDefaultBar example
$this
->
expectException
(
\InvalidArgumentException::
class
)
;
$valueResolver
=
$this
->
createMock
(
ArgumentValueResolverInterface::
class
)
;
$resolver
= self::
getResolver
(
[
$valueResolver
]
)
;
$valueResolver
->
expects
(
$this
->
any
(
)
)
->
method
(
'supports'
)
->
willReturn
(
true
)
;
$valueResolver
->
expects
(
$this
->
any
(
)
)
->
method
(
'resolve'
)
->
willReturn
(
[
]
)
;
$request
= Request::
create
(
'/'
)
;
$request
->attributes->
set
(
'foo', 'foo'
)
;
$request
->attributes->
set
(
'bar', 'foo'
)
;
$controller
=
$this
->
controllerWithFooAndDefaultBar
(
...
)
;
$resolver
->
getArguments
(
$request
,
$controller
)
;
}
public
function
testIfExceptionIsThrownWhenMissingAnArgument
(
)
{
$this
->
expectException
(
\RuntimeException::
class
)
;
$request
= Request::
create
(
'/'
)
;
$controller
=
$this
->
controllerWithFoo
(
...
)
;
self::
getResolver
(
)
->
getArguments
(
$request
,
$controller
)
;
}