mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-02 11:40:47 +05:30
Fix tests as no longer set the default scope in the constructor
Use new setDefaultScope() method instead. Also changed default scope to be a blank string instead of null
This commit is contained in:
parent
a49f6ff80d
commit
3828f87b19
@ -73,7 +73,7 @@ class AuthorizationServer implements EmitterAwareInterface
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $defaultScope = null;
|
private $defaultScope = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New server instance.
|
* New server instance.
|
||||||
@ -209,4 +209,14 @@ class AuthorizationServer implements EmitterAwareInterface
|
|||||||
|
|
||||||
return $this->responseType;
|
return $this->responseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the default scope for the authorization server.
|
||||||
|
*
|
||||||
|
* @param string $defaultScope
|
||||||
|
*/
|
||||||
|
public function setDefaultScope($defaultScope)
|
||||||
|
{
|
||||||
|
$this->defaultScope = $defaultScope;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,6 @@ class AuthorizationServerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->getMockBuilder(ScopeRepositoryInterface::class)->getMock(),
|
$this->getMockBuilder(ScopeRepositoryInterface::class)->getMock(),
|
||||||
'file://' . __DIR__ . '/Stubs/private.key',
|
'file://' . __DIR__ . '/Stubs/private.key',
|
||||||
base64_encode(random_bytes(36)),
|
base64_encode(random_bytes(36)),
|
||||||
self::DEFAULT_SCOPE,
|
|
||||||
new StubResponseType()
|
new StubResponseType()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -78,10 +77,10 @@ class AuthorizationServerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$scopeRepositoryMock,
|
$scopeRepositoryMock,
|
||||||
'file://' . __DIR__ . '/Stubs/private.key',
|
'file://' . __DIR__ . '/Stubs/private.key',
|
||||||
base64_encode(random_bytes(36)),
|
base64_encode(random_bytes(36)),
|
||||||
self::DEFAULT_SCOPE,
|
|
||||||
new StubResponseType()
|
new StubResponseType()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$server->setDefaultScope(self::DEFAULT_SCOPE);
|
||||||
$server->enableGrantType(new ClientCredentialsGrant(), new \DateInterval('PT1M'));
|
$server->enableGrantType(new ClientCredentialsGrant(), new \DateInterval('PT1M'));
|
||||||
|
|
||||||
$_POST['grant_type'] = 'client_credentials';
|
$_POST['grant_type'] = 'client_credentials';
|
||||||
@ -166,9 +165,10 @@ class AuthorizationServerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock(),
|
$this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock(),
|
||||||
$scopeRepositoryMock,
|
$scopeRepositoryMock,
|
||||||
'file://' . __DIR__ . '/Stubs/private.key',
|
'file://' . __DIR__ . '/Stubs/private.key',
|
||||||
'file://' . __DIR__ . '/Stubs/public.key',
|
'file://' . __DIR__ . '/Stubs/public.key'
|
||||||
self::DEFAULT_SCOPE
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$server->setDefaultScope(self::DEFAULT_SCOPE);
|
||||||
$server->enableGrantType($grant);
|
$server->enableGrantType($grant);
|
||||||
|
|
||||||
$request = new ServerRequest(
|
$request = new ServerRequest(
|
||||||
|
@ -40,10 +40,10 @@ class AuthorizationServerMiddlewareTest extends \PHPUnit_Framework_TestCase
|
|||||||
$scopeRepositoryMock,
|
$scopeRepositoryMock,
|
||||||
'file://' . __DIR__ . '/../Stubs/private.key',
|
'file://' . __DIR__ . '/../Stubs/private.key',
|
||||||
base64_encode(random_bytes(36)),
|
base64_encode(random_bytes(36)),
|
||||||
self::DEFAULT_SCOPE,
|
|
||||||
new StubResponseType()
|
new StubResponseType()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$server->setDefaultScope(self::DEFAULT_SCOPE);
|
||||||
$server->enableGrantType(new ClientCredentialsGrant());
|
$server->enableGrantType(new ClientCredentialsGrant());
|
||||||
|
|
||||||
$_POST['grant_type'] = 'client_credentials';
|
$_POST['grant_type'] = 'client_credentials';
|
||||||
|
Loading…
Reference in New Issue
Block a user