Skip to content

Commit db44e64

Browse files
formatting
1 parent cc3a244 commit db44e64

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/Entities/ClientEntityInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getRedirectUri(): string|array;
3939
*/
4040
public function isConfidential(): bool;
4141

42-
/**
42+
/*
4343
* Returns true if the client supports the given grant type.
4444
*
4545
* To be added in a future major release.

tests/Grant/AbstractGrantTest.php

+26-26
Original file line numberDiff line numberDiff line change
@@ -289,32 +289,6 @@ public function testValidateClientBadClient(): void
289289
$validateClientMethod->invoke($grantMock, $serverRequest, true);
290290
}
291291

292-
public function testUnauthorizedClient(): void
293-
{
294-
$client = $this->getMockBuilder(ClientEntity::class)->getMock();
295-
$client->method('supportsGrantType')->willReturn(false);
296-
297-
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
298-
$clientRepositoryMock
299-
->expects(self::once())
300-
->method('getClientEntity')
301-
->with('foo')
302-
->willReturn($client);
303-
304-
/** @var AbstractGrant $grantMock */
305-
$grantMock = $this->getMockForAbstractClass(AbstractGrant::class);
306-
$grantMock->setClientRepository($clientRepositoryMock);
307-
308-
$abstractGrantReflection = new ReflectionClass($grantMock);
309-
310-
$getClientEntityOrFailMethod = $abstractGrantReflection->getMethod('getClientEntityOrFail');
311-
$getClientEntityOrFailMethod->setAccessible(true);
312-
313-
$this->expectException(OAuthServerException::class);
314-
315-
$getClientEntityOrFailMethod->invoke($grantMock, 'foo', new ServerRequest());
316-
}
317-
318292
public function testCanRespondToRequest(): void
319293
{
320294
$grantMock = $this->getMockForAbstractClass(AbstractGrant::class);
@@ -553,4 +527,30 @@ public function testCompleteAuthorizationRequest(): void
553527

554528
$grantMock->completeAuthorizationRequest(new AuthorizationRequest());
555529
}
530+
531+
public function testUnauthorizedClient(): void
532+
{
533+
$client = $this->getMockBuilder(ClientEntity::class)->getMock();
534+
$client->method('supportsGrantType')->willReturn(false);
535+
536+
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
537+
$clientRepositoryMock
538+
->expects(self::once())
539+
->method('getClientEntity')
540+
->with('foo')
541+
->willReturn($client);
542+
543+
/** @var AbstractGrant $grantMock */
544+
$grantMock = $this->getMockForAbstractClass(AbstractGrant::class);
545+
$grantMock->setClientRepository($clientRepositoryMock);
546+
547+
$abstractGrantReflection = new ReflectionClass($grantMock);
548+
549+
$getClientEntityOrFailMethod = $abstractGrantReflection->getMethod('getClientEntityOrFail');
550+
$getClientEntityOrFailMethod->setAccessible(true);
551+
552+
$this->expectException(OAuthServerException::class);
553+
554+
$getClientEntityOrFailMethod->invoke($grantMock, 'foo', new ServerRequest());
555+
}
556556
}

0 commit comments

Comments
 (0)