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