|
7 | 7 |
|
8 | 8 | namespace ZendTest\Expressive\Middleware; |
9 | 9 |
|
| 10 | +use Fig\Http\Message\StatusCodeInterface as StatusCode; |
10 | 11 | use PHPUnit\Framework\TestCase; |
11 | 12 | use Prophecy\Prophecy\ObjectProphecy; |
12 | 13 | use Psr\Http\Message\ResponseInterface; |
@@ -58,7 +59,9 @@ public function testWritesResultsOfWhoopsExceptionsHandlingToResponse() |
58 | 59 | $this->request->getAttribute('originalUri', false)->shouldNotBeCalled(); |
59 | 60 | $this->request->getAttribute('originalRequest', false)->shouldNotBeCalled(); |
60 | 61 |
|
| 62 | + $this->response->withStatus(StatusCode::STATUS_INTERNAL_SERVER_ERROR)->will([$this->response, 'reveal']); |
61 | 63 | $this->response->getBody()->will([$this->stream, 'reveal']); |
| 64 | + $this->response->getStatusCode()->willReturn(StatusCode::STATUS_INTERNAL_SERVER_ERROR); |
62 | 65 |
|
63 | 66 | $this->stream->write('WHOOPS')->shouldBeCalled(); |
64 | 67 |
|
@@ -101,6 +104,8 @@ public function testAddsRequestMetadataToWhoopsPrettyPageHandler() |
101 | 104 | $this->request->getQueryParams()->willReturn([]); |
102 | 105 | $this->request->getParsedBody()->willReturn([]); |
103 | 106 |
|
| 107 | + $this->response->withStatus(StatusCode::STATUS_INTERNAL_SERVER_ERROR)->will([$this->response, 'reveal']); |
| 108 | + $this->response->getStatusCode()->willReturn(StatusCode::STATUS_INTERNAL_SERVER_ERROR); |
104 | 109 | $this->response->getBody()->will([$this->stream, 'reveal']); |
105 | 110 |
|
106 | 111 | $this->stream->write('WHOOPS')->shouldBeCalled(); |
@@ -137,6 +142,8 @@ public function testJsonContentTypeResponseWithJsonResponseHandler() |
137 | 142 | $this->request->getParsedBody()->willReturn([]); |
138 | 143 |
|
139 | 144 | $this->response->withHeader('Content-Type', 'application/json')->will([$this->response, 'reveal']); |
| 145 | + $this->response->withStatus(StatusCode::STATUS_INTERNAL_SERVER_ERROR)->will([$this->response, 'reveal']); |
| 146 | + $this->response->getStatusCode()->willReturn(StatusCode::STATUS_INTERNAL_SERVER_ERROR); |
140 | 147 | $this->response->getBody()->will([$this->stream, 'reveal']); |
141 | 148 |
|
142 | 149 | $this->stream->write('error')->shouldBeCalled(); |
|
0 commit comments