@@ -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