diff --git a/test/src/Provider/AbstractProviderTest.php b/test/src/Provider/AbstractProviderTest.php index ade51906..5dc8069b 100644 --- a/test/src/Provider/AbstractProviderTest.php +++ b/test/src/Provider/AbstractProviderTest.php @@ -617,7 +617,7 @@ public function parseResponseProvider() /** * @dataProvider parseResponseProvider */ - public function testParseResponse($body, $type, $parsed, $statusCode = 200) + public function testParseResponse($body, $type, $parsed, $statusCode = 200, $provider = null) { $stream = Mockery::mock(StreamInterface::class, [ '__toString' => $body, @@ -633,7 +633,12 @@ public function testParseResponse($body, $type, $parsed, $statusCode = 200) ->andReturn($type); $method = $this->getMethod(AbstractProvider::class, 'parseResponse'); - $result = $method->invoke($this->getMockProvider(), $response); + + if (null === $provider) { + $provider = $this->getMockProvider(); + } + + $result = $method->invoke($provider, $response); $this->assertEquals($parsed, $result); } @@ -652,17 +657,18 @@ public function testParseResponseNonJsonFailure() public function testResponseParsingException() { - $this->provider->allowResponseParsingException(); + $provider = $this->getMockProvider(); + $provider->allowResponseParsingException(); $exception = null; try { - $this->testParseResponse('{13}', '', null, 401); + $this->testParseResponse('{13}', 'application/json', null, 401, $provider); } catch (ResponseParsingException $exception) { } $this->assertInstanceOf(ResponseParsingException::class, $exception); $response = $exception->getResponse(); $this->assertSame(401, $response->getStatusCode()); $this->assertSame('{13}', $exception->getResponseBody()); - $this->provider->disallowResponseParsingException(); + $provider->disallowResponseParsingException(); } public function getAppendQueryProvider()