public function testResponseErrorMessageIncludesStackTraceIfDevelopmentModeIsEnabled()
{
$exception = new RuntimeException('Exception raised', 503);
$this->delegate->process(Argument::type(ServerRequestInterface::class))->willThrow($exception);
$this->body->write((new Escaper())->escapeHtml((string) $exception))->shouldBeCalled();
$this->response->getStatusCode()->willReturn(200);
$this->response->withStatus(503)->will([$this->response, 'reveal']);
$this->response->getReasonPhrase()->willReturn('');
$this->response->getBody()->will([$this->body, 'reveal']);
$middleware = $this->createMiddleware(true);
$result = $middleware->process($this->request->reveal(), $this->delegate->reveal());
$this->assertSame($this->response->reveal(), $result);
}