mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-30 02:33:14 +05:30
Add a basic test to ensure we throw an exception when no scope is given
This commit is contained in:
parent
3828f87b19
commit
d0619385b8
@ -459,6 +459,21 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$grantMock->validateScopes('basic ');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \League\OAuth2\Server\Exception\OAuthServerException
|
||||
* @expectedExceptionCode 11
|
||||
*/
|
||||
public function testValidateScopesMissingScope()
|
||||
{
|
||||
$scopeRepositoryMock = $this->getMockBuilder(ScopeRepositoryInterface::class)->getMock();
|
||||
$scopeRepositoryMock->method('getScopeEntityByIdentifier')->willReturn(null);
|
||||
|
||||
$grantMock = $this->getMockForAbstractClass(AbstractGrant::class);
|
||||
$grantMock->setScopeRepository($scopeRepositoryMock);
|
||||
|
||||
$grantMock->validateScopes('');
|
||||
}
|
||||
|
||||
public function testGenerateUniqueIdentifier()
|
||||
{
|
||||
$grantMock = $this->getMockForAbstractClass(AbstractGrant::class);
|
||||
|
Loading…
Reference in New Issue
Block a user