File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,32 @@ public function errorMessageIsCorrectGivenWhenAuthenticationError(): void
233
233
new RestClient (self ::$ configuration );
234
234
}
235
235
236
+ /**
237
+ * @test
238
+ */
239
+ public function errorMessageIsCorrectGivenWhenRequestError (): void
240
+ {
241
+ $ this ->expectException (HttpException::class);
242
+ $ this ->expectExceptionCode (404 );
243
+ $ this ->expectExceptionMessage ('Error fetching route some/route: Some error occured. ' );
244
+
245
+ $ this ->setResponseOfTokensPath ();
246
+
247
+ self ::$ server ->setResponseOfPath (
248
+ '/api/rest/v2/some/route ' ,
249
+ new Response (
250
+ \sprintf (
251
+ '{"errors":{"-": ["%s"]}} ' ,
252
+ 'Some error occured. '
253
+ ),
254
+ ['content-type ' => 'application/json ' ],
255
+ 404
256
+ )
257
+ );
258
+
259
+ (new RestClient (self ::$ configuration ))->request ('GET ' , 'some/route ' );
260
+ }
261
+
236
262
/**
237
263
* @test
238
264
*/
You can’t perform that action at this time.
0 commit comments