@@ -352,10 +352,11 @@ public static function getLastCallFailedData(): array
352352
353353 /**
354354 * @covers ::retrieveData
355+ * @covers ::getResponseAsArray
355356 *
356357 * @dataProvider retrieveDataData
357358 */
358- public function testRetrieveData ($ response , $ contentType , $ expected )
359+ public function testRetrieveData ($ path , $ contentType, $ response , $ expected )
359360 {
360361 $ client = $ this ->createMock (Client::class);
361362 $ client ->method ('requestGet ' )->willReturn (true );
@@ -367,13 +368,24 @@ public function testRetrieveData($response, $contentType, $expected)
367368 $ method = new ReflectionMethod ($ api , 'retrieveData ' );
368369 $ method ->setAccessible (true );
369370
370- $ this ->assertSame ($ expected , $ method ->invoke ($ api , ' /issues.json ' ));
371+ $ this ->assertSame ($ expected , $ method ->invoke ($ api , $ path ));
371372 }
372373
373374 public static function retrieveDataData (): array
374375 {
375376 return [
376- 'test decode by default ' => ['{"foo_bar": 12345} ' , 'application/json ' , ['foo_bar ' => 12345 ]],
377+ 'test json decode by default ' => [
378+ '/issues.json ' ,
379+ 'application/json ' ,
380+ '{"foo_bar": 12345} ' ,
381+ ['foo_bar ' => 12345 ],
382+ ],
383+ 'test xml decode by default ' => [
384+ '/issues.xml ' ,
385+ 'application/xml ' ,
386+ '<?xml version="1.0"?><issues type="array"></issues> ' ,
387+ ['@attributes ' => ['type ' => 'array ' ]],
388+ ],
377389 ];
378390 }
379391
0 commit comments