public function HttpKernelTest::testHandleHttpException 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::testHandleHttpException()
File
- vendor/
symfony/ http-kernel/ Tests/ HttpKernelTest.php, line 93
Class
Namespace
Symfony\Component\HttpKernel\TestsCode
public function testHandleHttpException() {
$dispatcher = new EventDispatcher();
$dispatcher
->addListener(KernelEvents::EXCEPTION, function ($event) {
$event
->setResponse(new Response($event
->getException()
->getMessage()));
});
$kernel = new HttpKernel($dispatcher, $this
->getResolver(function () {
throw new MethodNotAllowedHttpException(array(
'POST',
));
}));
$response = $kernel
->handle(new Request());
$this
->assertEquals('405', $response
->getStatusCode());
$this
->assertEquals('POST', $response->headers
->get('Allow'));
}