|
13 | 13 | use GuzzleHttp\Exception\ConnectException; |
14 | 14 | use GuzzleHttp\Exception\RequestException; |
15 | 15 | use GuzzleHttp\Exception\ServerException; |
| 16 | +use GuzzleHttp\Psr7\Utils; |
16 | 17 | use OCA\OpenProject\Service\OpenProjectAPIService; |
17 | 18 | use OCP\Http\Client\IResponse; |
18 | 19 | use OCP\Http\Client\LocalServerException; |
@@ -161,21 +162,22 @@ public function isValidOpenProjectInstanceExpectionDataProvider() { |
161 | 162 | $requestMock = $this->getMockBuilder('\Psr\Http\Message\RequestInterface')->getMock(); |
162 | 163 | $privateInstance = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); |
163 | 164 | $privateInstance->method('getBody')->willReturn( |
164 | | - '{"_type":"Error","errorIdentifier":"urn:openproject-org:api:v3:errors:Unauthenticated"}' |
| 165 | + Utils::streamFor('{"_type":"Error","errorIdentifier":"urn:openproject-org:api:v3:errors:Unauthenticated"}') |
165 | 166 | ); |
166 | 167 | $notOP = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); |
167 | | - $notOP->method('getBody')->willReturn('Unauthenticated'); |
| 168 | + $notOPResponseBody = 'Unauthenticated'; |
| 169 | + $notOP->method('getBody')->willReturn(Utils::streamFor($notOPResponseBody)); |
168 | 170 | $notOP->method('getReasonPhrase')->willReturn('Unauthenticated'); |
169 | | - $notOP->method('getStatusCode')->willReturn('401'); |
| 171 | + $notOP->method('getStatusCode')->willReturn(401); |
170 | 172 | $notOPButJSON = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); |
171 | 173 | $notOPButJSON->method('getBody')->willReturn( |
172 | | - '{"what":"Error","why":"Unauthenticated"}' |
| 174 | + Utils::streamFor('{"what":"Error","why":"Unauthenticated"}') |
173 | 175 | ); |
174 | 176 | $notOPButJSON->method('getReasonPhrase')->willReturn('Unauthenticated'); |
175 | | - $notOPButJSON->method('getStatusCode')->willReturn('401'); |
| 177 | + $notOPButJSON->method('getStatusCode')->willReturn(401); |
176 | 178 | $otherResponseMock = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); |
177 | 179 | $otherResponseMock->method('getReasonPhrase')->willReturn('Internal Server Error'); |
178 | | - $otherResponseMock->method('getStatusCode')->willReturn('500'); |
| 180 | + $otherResponseMock->method('getStatusCode')->willReturn(500); |
179 | 181 | return [ |
180 | 182 | [ |
181 | 183 | new ConnectException('a connection problem', $requestMock), |
|
0 commit comments