ZendTest\Stratigility\Middleware\ErrorHandlerTest::testReturnsErrorResponseIfDelegateRaisesAnException PHP Метод

testReturnsErrorResponseIfDelegateRaisesAnException() публичный Метод

    public function testReturnsErrorResponseIfDelegateRaisesAnException()
    {
        $this->delegate->process(Argument::type(ServerRequestInterface::class))->willThrow(new RuntimeException('Exception raised', 503));
        $this->body->write('Unknown Error')->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();
        $result = $middleware->process($this->request->reveal(), $this->delegate->reveal());
        $this->assertSame($this->response->reveal(), $result);
    }