public function testReturnsErrorResponseIfDelegateDoesNotReturnAResponse()
{
$this->delegate->process(Argument::type(ServerRequestInterface::class))->willReturn(null);
$this->body->write('Unknown Error')->shouldBeCalled();
$this->response->getStatusCode()->willReturn(200);
$this->response->withStatus(500)->will([$this->response, 'reveal']);
$this->response->getReasonPhrase()->willReturn('');
$this->response->getBody()->will([$this->body, 'reveal']);
$middleware = $this->createMiddleware();
$result = $middleware->process($this->request->reveal(), $this->delegate->reveal());
$this->assertSame($this->response->reveal(), $result);
}