Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilePerron authored Jul 28, 2023
2 parents d4a4765 + 9dcae75 commit 0cedbe3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/Provider/WebflowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use League\OAuth2\Client\Token\AccessToken;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;

class WebflowTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -61,7 +62,10 @@ public function testGetAccessToken()
{
/** @var MockObject|ResponseInterface $response */
$response = $this->createMock(ResponseInterface::class);
$response->expects($this->once())->method('getBody')->willReturn('{"access_token":"mock_access_token", "token_type":"bearer"}');
/** @var MockObject|StreamInterface $responseBody */
$responseBody = $this->createMock(StreamInterface::class);
$responseBody->expects($this->once())->method('__toString')->willReturn('{"access_token":"mock_access_token", "token_type":"bearer"}');
$response->expects($this->once())->method('getBody')->willReturn($responseBody);
$response->expects($this->once())->method('getHeader')->willReturn([
'content-type' => 'json',
]);
Expand All @@ -85,7 +89,10 @@ public function testExceptionThrownUponOauthError()
{
/** @var MockObject|ResponseInterface $response */
$response = $this->createMock(ResponseInterface::class);
$response->method('getBody')->willReturn('{"error":"invalid_grant"}');
/** @var MockObject|StreamInterface $responseBody */
$responseBody = $this->createMock(StreamInterface::class);
$responseBody->method('__toString')->willReturn('{"error":"invalid_grant"}');
$response->method('getBody')->willReturn($responseBody);
$response->method('getHeader')->willReturn([
'content-type' => 'json',
]);
Expand Down

0 comments on commit 0cedbe3

Please sign in to comment.