Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
testHook example
$executor
=
static
::
createMock
(
ScriptExecutor::
class
)
;
$executor
->
expects
(
static
::
once
(
)
)
->
method
(
'execute'
)
->
with
(
$hook
)
;
$container
=
new
ContainerBuilder
(
)
;
$container
->
set
(
ScriptExecutor::
class
,
$executor
)
;
$this
->controller->
setContainer
(
$container
)
;
$this
->controller->
testHook
(
$hook
)
;
}
public
function
testRedirectEvent
(
)
: void
{
$event
=
new
StorefrontRedirectEvent
(
'test_route',
[
'test' => 'param'
]
)
;
$dispatcher
=
static
::
createMock
(
EventDispatcherInterface::
class
)
;
$dispatcher
->
expects
(
static
::
once
(
)
)
->
method
(
'dispatch'
)
->
with
(
static
::
equalTo
(
$event
)
)
;