From 4998c4a2f2afaa17cc644a666eeb4f7a69bb9663 Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Tue, 19 Nov 2024 12:51:46 +0330 Subject: [PATCH] fix tests --- tests/Grant/AuthCodeGrantTest.php | 1 + tests/Grant/DeviceCodeGrantTest.php | 6 +++--- tests/Grant/RefreshTokenGrantTest.php | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/Grant/AuthCodeGrantTest.php b/tests/Grant/AuthCodeGrantTest.php index f30b8a093..393359cf0 100644 --- a/tests/Grant/AuthCodeGrantTest.php +++ b/tests/Grant/AuthCodeGrantTest.php @@ -1745,6 +1745,7 @@ public function testRespondToAccessTokenRequestNoEncryptionKey(): void [ 'grant_type' => 'authorization_code', 'client_id' => 'foo', + 'client_secret' => 'bar', 'redirect_uri' => self::REDIRECT_URI, 'code' => 'badCode', ] diff --git a/tests/Grant/DeviceCodeGrantTest.php b/tests/Grant/DeviceCodeGrantTest.php index cdbb843e4..c02c1de08 100644 --- a/tests/Grant/DeviceCodeGrantTest.php +++ b/tests/Grant/DeviceCodeGrantTest.php @@ -301,7 +301,7 @@ public function testDeviceAuthorizationResponse(): void $server->setDefaultScope(self::DEFAULT_SCOPE); $serverRequest = (new ServerRequest())->withParsedBody([ - 'client_id' => 'foo', + 'client_id' => 'foo', ]); $deviceCodeGrant = new DeviceCodeGrant( @@ -698,8 +698,8 @@ public function testIssueAccessDeniedError(): void $grant->completeDeviceAuthorizationRequest($deviceCode->getIdentifier(), '1', false); $serverRequest = (new ServerRequest())->withParsedBody([ - 'client_id' => 'foo', - 'device_code' => $deviceCode->getIdentifier(), + 'client_id' => 'foo', + 'device_code' => $deviceCode->getIdentifier(), ]); $responseType = new StubResponseType(); diff --git a/tests/Grant/RefreshTokenGrantTest.php b/tests/Grant/RefreshTokenGrantTest.php index 1d8c23a27..1fe1eadab 100644 --- a/tests/Grant/RefreshTokenGrantTest.php +++ b/tests/Grant/RefreshTokenGrantTest.php @@ -784,7 +784,9 @@ public function testRespondToRequestWithIntUserId(): void $scopeRepositoryMock->method('finalizeScopes')->willReturn([$scopeEntity]); $accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock(); - $accessTokenRepositoryMock->method('getNewToken')->willReturn(new AccessTokenEntity()); + $accessTokenEntity = new AccessTokenEntity(); + $accessTokenEntity->setClient($client); + $accessTokenRepositoryMock->method('getNewToken')->willReturn($accessTokenEntity); $accessTokenRepositoryMock->expects(self::once())->method('persistNewAccessToken')->willReturnSelf(); $refreshTokenRepositoryMock = $this->getMockBuilder(RefreshTokenRepositoryInterface::class)->getMock();