public function HttpKernelTest::testHandleExceptionWithARedirectionResponse in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Tests/HttpKernelTest.php \Symfony\Component\HttpKernel\Tests\HttpKernelTest::testHandleExceptionWithARedirectionResponse()
File
- vendor/
symfony/ http-kernel/ Tests/ HttpKernelTest.php, line 79
Class
Namespace
Symfony\Component\HttpKernel\TestsCode
public function testHandleExceptionWithARedirectionResponse() {
$dispatcher = new EventDispatcher();
$dispatcher
->addListener(KernelEvents::EXCEPTION, function ($event) {
$event
->setResponse(new RedirectResponse('/login', 301));
});
$kernel = new HttpKernel($dispatcher, $this
->getResolver(function () {
throw new AccessDeniedHttpException();
}));
$response = $kernel
->handle(new Request());
$this
->assertEquals('301', $response
->getStatusCode());
$this
->assertEquals('/login', $response->headers
->get('Location'));
}