@dataProvider getStatusCodes
public function testHandleWhenAnExceptionIsHandledWithASpecificStatusCode($responseStatusCode, $expectedStatusCode) {
$dispatcher = new EventDispatcher();
$dispatcher
->addListener(KernelEvents::EXCEPTION, function ($event) use ($responseStatusCode, $expectedStatusCode) {
$event
->setResponse(new Response('', $responseStatusCode, array(
'X-Status-Code' => $expectedStatusCode,
)));
});
$kernel = new HttpKernel($dispatcher, $this
->getResolver(function () {
throw new \RuntimeException();
}));
$response = $kernel
->handle(new Request());
$this
->assertEquals($expectedStatusCode, $response
->getStatusCode());
$this
->assertFalse($response->headers
->has('X-Status-Code'));
}