mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Added tests for resource server middleware
This commit is contained in:
28
tests/ResourceServerTest.php
Normal file
28
tests/ResourceServerTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace LeagueTests;
|
||||
|
||||
|
||||
use League\OAuth2\Server\Exception\OAuthServerException;
|
||||
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;
|
||||
use League\OAuth2\Server\ResourceServer;
|
||||
use Zend\Diactoros\ServerRequestFactory;
|
||||
|
||||
class ResourceServerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testValidateAuthenticatedRequest()
|
||||
{
|
||||
$server = new ResourceServer(
|
||||
$this->getMock(AccessTokenRepositoryInterface::class),
|
||||
'file://' . __DIR__ . '/Stubs/public.key'
|
||||
);
|
||||
|
||||
try {
|
||||
$server->validateAuthenticatedRequest(ServerRequestFactory::fromGlobals());
|
||||
} catch (OAuthServerException $e) {
|
||||
$this->assertEquals('Missing "Authorization" header', $e->getHint());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user