Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
IndexController example
class
IndexControllerTest
extends
TestCase
{
public
function
testIndexRedirectsToInstall
(
)
: void
{
$router
=
$this
->
createMock
(
Router::
class
)
;
$router
->
method
(
'generate'
)
->
willReturnArgument
(
0
)
;
$controller
=
new
IndexController
(
)
;
$container
=
new
Container
(
)
;
$container
->
set
(
'router',
$router
)
;
$twig
=
$this
->
createMock
(
Environment::
class
)
;
$twig
->
method
(
'render'
)
->
willReturnArgument
(
0
)
;
$container
->
set
(
'twig',
$twig
)
;
$controller
->
setContainer
(
$container
)
;
$response
=
$controller
->
index
(
)
;