|
|
@ -32,6 +32,10 @@ class ErrorHandlerTest extends TestCase
|
|
|
|
$psrResponse->expects($this->once())
|
|
|
|
$psrResponse->expects($this->once())
|
|
|
|
->method('getStatusCode')
|
|
|
|
->method('getStatusCode')
|
|
|
|
->willReturn(505);
|
|
|
|
->willReturn(505);
|
|
|
|
|
|
|
|
$psrResponse->expects($this->once())
|
|
|
|
|
|
|
|
->method('getHeader')
|
|
|
|
|
|
|
|
->with('content-type')
|
|
|
|
|
|
|
|
->willReturn([]);
|
|
|
|
|
|
|
|
|
|
|
|
$errorHandler = new ErrorHandler($twigLoader);
|
|
|
|
$errorHandler = new ErrorHandler($twigLoader);
|
|
|
|
|
|
|
|
|
|
|
@ -41,13 +45,22 @@ class ErrorHandlerTest extends TestCase
|
|
|
|
/** @var Response|MockObject $response */
|
|
|
|
/** @var Response|MockObject $response */
|
|
|
|
$response = $this->createMock(Response::class);
|
|
|
|
$response = $this->createMock(Response::class);
|
|
|
|
|
|
|
|
|
|
|
|
$response->expects($this->exactly(3))
|
|
|
|
$response->expects($this->exactly(4))
|
|
|
|
->method('getStatusCode')
|
|
|
|
->method('getStatusCode')
|
|
|
|
->willReturnOnConsecutiveCalls(
|
|
|
|
->willReturnOnConsecutiveCalls(
|
|
|
|
200,
|
|
|
|
200,
|
|
|
|
418,
|
|
|
|
418,
|
|
|
|
|
|
|
|
505,
|
|
|
|
505
|
|
|
|
505
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
$response->expects($this->exactly(4))
|
|
|
|
|
|
|
|
->method('getHeader')
|
|
|
|
|
|
|
|
->willReturnOnConsecutiveCalls(
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
['application/json']
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$returnResponseHandler->setResponse($response);
|
|
|
|
$returnResponseHandler->setResponse($response);
|
|
|
|
$return = $errorHandler->process($request, $returnResponseHandler);
|
|
|
|
$return = $errorHandler->process($request, $returnResponseHandler);
|
|
|
@ -85,6 +98,7 @@ class ErrorHandlerTest extends TestCase
|
|
|
|
|
|
|
|
|
|
|
|
$errorHandler->process($request, $returnResponseHandler);
|
|
|
|
$errorHandler->process($request, $returnResponseHandler);
|
|
|
|
$errorHandler->process($request, $returnResponseHandler);
|
|
|
|
$errorHandler->process($request, $returnResponseHandler);
|
|
|
|
|
|
|
|
$errorHandler->process($request, $returnResponseHandler);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -104,6 +118,10 @@ class ErrorHandlerTest extends TestCase
|
|
|
|
$psrResponse->expects($this->once())
|
|
|
|
$psrResponse->expects($this->once())
|
|
|
|
->method('getStatusCode')
|
|
|
|
->method('getStatusCode')
|
|
|
|
->willReturn(300);
|
|
|
|
->willReturn(300);
|
|
|
|
|
|
|
|
$psrResponse->expects($this->once())
|
|
|
|
|
|
|
|
->method('getHeader')
|
|
|
|
|
|
|
|
->with('content-type')
|
|
|
|
|
|
|
|
->willReturn([]);
|
|
|
|
|
|
|
|
|
|
|
|
$returnResponseHandler->expects($this->once())
|
|
|
|
$returnResponseHandler->expects($this->once())
|
|
|
|
->method('handle')
|
|
|
|
->method('handle')
|
|
|
|