Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createControllerEvent example
use
Symfony\Component\HttpKernel\KernelInterface;
class
RouterDataCollectorTest
extends
TestCase
{
public
function
testRouteRedirectResponse
(
)
{
$collector
=
new
RouterDataCollector
(
)
;
$request
= Request::
create
(
'http://test.com/foo?bar=baz'
)
;
$response
=
new
RedirectResponse
(
'http://test.com/redirect'
)
;
$event
=
$this
->
createControllerEvent
(
$request
)
;
$collector
->
onKernelController
(
$event
)
;
$collector
->
collect
(
$request
,
$response
)
;
$this
->
assertTrue
(
$collector
->
getRedirect
(
)
)
;
$this
->
assertEquals
(
'http://test.com/redirect',
$collector
->
getTargetUrl
(
)
)
;
$this
->
assertEquals
(
'n/a',
$collector
->
getTargetRoute
(
)
)
;
}
public
function
testRouteNotRedirectResponse
(
)
{