From 6301772bd7e9253a8542b99572a6ffbf1ccb48fe Mon Sep 17 00:00:00 2001 From: Korvin Szanto Date: Thu, 15 Feb 2024 11:11:32 -0800 Subject: [PATCH 1/3] PSR7 ResponseInterface::getHeader returns array --- test/src/Provider/AbstractProviderTest.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/src/Provider/AbstractProviderTest.php b/test/src/Provider/AbstractProviderTest.php index b9ebf6f1..5ed5a219 100644 --- a/test/src/Provider/AbstractProviderTest.php +++ b/test/src/Provider/AbstractProviderTest.php @@ -213,7 +213,7 @@ public function testGetUserProperties($name = null, $email = null, $id = null) ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::spy(ClientInterface::class, [ @@ -262,7 +262,7 @@ public function testGetUserPropertiesThrowsExceptionWhenNonJsonResponseIsReceive $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn('text/html'); + ->andReturn(['text/html']); $client = Mockery::mock(ClientInterface::class, [ 'send' => $response, @@ -378,7 +378,7 @@ public function testPkceMethod($pkceMethod, $pkceCode, $expectedChallenge) ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::spy(ClientInterface::class, [ 'send' => $response, @@ -474,7 +474,7 @@ public function testErrorResponsesCanBeCustomizedAtTheProvider() ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::spy(ClientInterface::class, [ 'send' => $response, @@ -532,7 +532,7 @@ public function testClientErrorTriggersProviderException() $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::mock(ClientInterface::class); $client @@ -579,7 +579,7 @@ public function testAuthenticatedRequestAndResponse() $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::mock(ClientInterface::class); $client @@ -647,7 +647,7 @@ public function testGetAccessToken($method) ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::spy(ClientInterface::class, [ 'send' => $response, @@ -686,7 +686,7 @@ public function testGetAccessTokenWithNonJsonResponse() $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn('text/plain'); + ->andReturn(['text/plain']); $client = Mockery::mock(ClientInterface::class, [ 'send' => $response, @@ -740,12 +740,12 @@ public function testParseResponse($body, $type, $parsed, $statusCode = 200) $response = Mockery::mock(ResponseInterface::class, [ 'getBody' => $stream, - 'getStatusCode' => $statusCode, + 'getStatusCode' => $statusCode,s ]); $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn($type); + ->andReturn([$type]); $method = $this->getMethod(AbstractProvider::class, 'parseResponse'); $result = $method->invoke($this->getMockProvider(), $response); From b614ea7a65b1580d09365f3bfb1724ccbab21635 Mon Sep 17 00:00:00 2001 From: Korvin Szanto Date: Thu, 15 Feb 2024 11:14:41 -0800 Subject: [PATCH 2/3] Remove typo --- test/src/Provider/AbstractProviderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/Provider/AbstractProviderTest.php b/test/src/Provider/AbstractProviderTest.php index 5ed5a219..93cf97a7 100644 --- a/test/src/Provider/AbstractProviderTest.php +++ b/test/src/Provider/AbstractProviderTest.php @@ -740,7 +740,7 @@ public function testParseResponse($body, $type, $parsed, $statusCode = 200) $response = Mockery::mock(ResponseInterface::class, [ 'getBody' => $stream, - 'getStatusCode' => $statusCode,s + 'getStatusCode' => $statusCode, ]); $response ->shouldReceive('getHeader') From caade89cf554ef2e8f44b7ee8a2fdff0af1210df Mon Sep 17 00:00:00 2001 From: Korvin Szanto Date: Thu, 15 Feb 2024 11:26:18 -0800 Subject: [PATCH 3/3] Replace more getHeader calls --- test/src/Grant/GrantTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/Grant/GrantTestCase.php b/test/src/Grant/GrantTestCase.php index 5451b331..125c66ce 100644 --- a/test/src/Grant/GrantTestCase.php +++ b/test/src/Grant/GrantTestCase.php @@ -65,7 +65,7 @@ public function testGetAccessToken($grant, array $params = []) ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); /** @var ClientInterface & MockInterface $client */ $client = Mockery::spy(ClientInterface::class)->makePartial();