+ /**
+ * @dataProvider getSpecificStatusCodes
+ */
+ public function testHandleWhenAnExceptionIsHandledWithASpecificStatusCode($expectedStatusCode)
+ {
+ $dispatcher = new EventDispatcher();
+ $dispatcher->addListener(KernelEvents::EXCEPTION, function (GetResponseForExceptionEvent $event) use ($expectedStatusCode) {
+ $event->allowCustomResponseCode();
+ $event->setResponse(new Response('', $expectedStatusCode));
+ });
+
+ $kernel = $this->getHttpKernel($dispatcher, function () { throw new \RuntimeException(); });
+ $response = $kernel->handle(new Request());
+
+ $this->assertEquals($expectedStatusCode, $response->getStatusCode());
+ }
+
+ public function getSpecificStatusCodes()
+ {
+ return array(
+ array(200),
+ array(302),
+ array(403),
+ );
+ }
+