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'));
}