Skip to content

Commit

Permalink
Fix tests by returning array from PSR7's ResponseInterface::getHeader…
Browse files Browse the repository at this point in the history
…() (#1026)

* PSR7 ResponseInterface::getHeader returns array

* Remove typo

* Replace more getHeader calls
  • Loading branch information
KorvinSzanto authored Dec 10, 2024
1 parent bc40e20 commit e4c6ec7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion test/src/Grant/GrantTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
18 changes: 9 additions & 9 deletions test/src/Provider/AbstractProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -745,7 +745,7 @@ public function testParseResponse($body, $type, $parsed, $statusCode = 200)
$response
->shouldReceive('getHeader')
->with('content-type')
->andReturn($type);
->andReturn([$type]);

$method = $this->getMethod(AbstractProvider::class, 'parseResponse');
$result = $method->invoke($this->getMockProvider(), $response);
Expand Down

0 comments on commit e4c6ec7

Please sign in to comment.