Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
homeAction example
class
ProfilerControllerTest
extends
WebTestCase
{
public
function
testHomeActionWithProfilerDisabled
(
)
{
$this
->
expectException
(
NotFoundHttpException::
class
)
;
$this
->
expectExceptionMessage
(
'The profiler must be enabled.'
)
;
$urlGenerator
=
$this
->
createMock
(
UrlGeneratorInterface::
class
)
;
$twig
=
$this
->
createMock
(
Environment::
class
)
;
$controller
=
new
ProfilerController
(
$urlGenerator
, null,
$twig
,
[
]
)
;
$controller
->
homeAction
(
)
;
}
public
function
testHomeActionRedirect
(
)
{
$kernel
=
new
WebProfilerBundleKernel
(
)
;
$client
=
new
KernelBrowser
(
$kernel
)
;
$client
->
request
(
'GET', '/_profiler/'
)
;
$this
->
assertSame
(
302,
$client
->
getResponse
(
)
->
getStatusCode
(
)
)
;
$this
->
assertSame
(
'/_profiler/empty/search/results?limit=10',
$client
->
getResponse
(
)
->
getTargetUrl
(
)
)
;
}