public function testCanCheckAndGetForGrants() { $clientService = $this->getMock(ClientService::class, [], [], '', false); $grant = new PasswordGrant($this->getMock(TokenService::class, [], [], '', false), $this->getMock(TokenService::class, [], [], '', false), function () { }); $accessTokenService = $this->getMock(TokenService::class, [], [], '', false); $refreshTokenService = $this->getMock(TokenService::class, [], [], '', false); $authorizationServer = new AuthorizationServer($clientService, [$grant], $accessTokenService, $refreshTokenService); $this->assertTrue($authorizationServer->hasGrant(PasswordGrant::GRANT_TYPE)); $this->assertFalse($authorizationServer->hasGrant(ClientCredentialsGrant::GRANT_TYPE)); $this->assertSame($grant, $authorizationServer->getGrant(PasswordGrant::GRANT_TYPE)); $this->setExpectedException(OAuth2Exception::class, null, 'unsupported_grant_type'); $authorizationServer->getGrant(ClientCredentialsGrant::GRANT_TYPE); }