@@ -617,7 +617,7 @@ public function parseResponseProvider()
617
617
/**
618
618
* @dataProvider parseResponseProvider
619
619
*/
620
- public function testParseResponse ($ body , $ type , $ parsed , $ statusCode = 200 )
620
+ public function testParseResponse ($ body , $ type , $ parsed , $ statusCode = 200 , $ provider = null )
621
621
{
622
622
$ stream = Mockery::mock (StreamInterface::class, [
623
623
'__toString ' => $ body ,
@@ -633,7 +633,12 @@ public function testParseResponse($body, $type, $parsed, $statusCode = 200)
633
633
->andReturn ($ type );
634
634
635
635
$ method = $ this ->getMethod (AbstractProvider::class, 'parseResponse ' );
636
- $ result = $ method ->invoke ($ this ->getMockProvider (), $ response );
636
+
637
+ if (null === $ provider ) {
638
+ $ provider = $ this ->getMockProvider ();
639
+ }
640
+
641
+ $ result = $ method ->invoke ($ provider , $ response );
637
642
638
643
$ this ->assertEquals ($ parsed , $ result );
639
644
}
@@ -652,17 +657,18 @@ public function testParseResponseNonJsonFailure()
652
657
653
658
public function testResponseParsingException ()
654
659
{
655
- $ this ->provider ->allowResponseParsingException ();
660
+ $ provider = $ this ->getMockProvider ();
661
+ $ provider ->allowResponseParsingException ();
656
662
$ exception = null ;
657
663
try {
658
- $ this ->testParseResponse ('{13} ' , '' , null , 401 );
664
+ $ this ->testParseResponse ('{13} ' , 'application/json ' , null , 401 , $ provider );
659
665
} catch (ResponseParsingException $ exception ) {
660
666
}
661
667
$ this ->assertInstanceOf (ResponseParsingException::class, $ exception );
662
668
$ response = $ exception ->getResponse ();
663
669
$ this ->assertSame (401 , $ response ->getStatusCode ());
664
670
$ this ->assertSame ('{13} ' , $ exception ->getResponseBody ());
665
- $ this -> provider ->disallowResponseParsingException ();
671
+ $ provider ->disallowResponseParsingException ();
666
672
}
667
673
668
674
public function getAppendQueryProvider ()
0 commit comments