2016-04-17 17:24:39 +05:30
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace LeagueTests;
|
|
|
|
|
|
|
|
use League\OAuth2\Server\Exception\OAuthServerException;
|
|
|
|
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;
|
|
|
|
use League\OAuth2\Server\ResourceServer;
|
2017-11-08 23:37:07 +05:30
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-04-17 17:24:39 +05:30
|
|
|
use Zend\Diactoros\ServerRequestFactory;
|
|
|
|
|
2017-11-08 23:37:07 +05:30
|
|
|
class ResourceServerTest extends TestCase
|
2016-04-17 17:24:39 +05:30
|
|
|
{
|
|
|
|
public function testValidateAuthenticatedRequest()
|
|
|
|
{
|
|
|
|
$server = new ResourceServer(
|
2016-07-08 18:59:21 +05:30
|
|
|
$this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock(),
|
2016-04-17 17:24:39 +05:30
|
|
|
'file://' . __DIR__ . '/Stubs/public.key'
|
|
|
|
);
|
|
|
|
|
|
|
|
try {
|
|
|
|
$server->validateAuthenticatedRequest(ServerRequestFactory::fromGlobals());
|
|
|
|
} catch (OAuthServerException $e) {
|
|
|
|
$this->assertEquals('Missing "Authorization" header', $e->getHint());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|