diff options
author | Mario <mario@mariovavti.com> | 2018-03-09 11:12:18 +0100 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2018-03-09 11:12:18 +0100 |
commit | 4baf5eab16d809977a44e7911ddcab0ff8383897 (patch) | |
tree | 393f618c4cfc20f53264ecd8a26a08de0823d35d /vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller | |
parent | 577da0eb9eb1f90a4cf7a70cfb3582cfb49007ac (diff) | |
parent | 7361af85b5488fc8bd1744389a3a332dc74276b0 (diff) | |
download | volse-hubzilla-3.2.tar.gz volse-hubzilla-3.2.tar.bz2 volse-hubzilla-3.2.zip |
Merge branch '3.2RC'3.2
Diffstat (limited to 'vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller')
3 files changed, 48 insertions, 3 deletions
diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php index 3bfc760e4..fe3553b23 100644 --- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php +++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/AuthorizeControllerTest.php @@ -10,8 +10,9 @@ use OAuth2\GrantType\AuthorizationCode; use OAuth2\Request; use OAuth2\Response; use OAuth2\Request\TestRequest; +use PHPUnit\Framework\TestCase; -class AuthorizeControllerTest extends \PHPUnit_Framework_TestCase +class AuthorizeControllerTest extends TestCase { public function testNoClientIdResponse() { diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/ResourceControllerTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/ResourceControllerTest.php index b277514a5..cd54d239a 100644 --- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/ResourceControllerTest.php +++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/ResourceControllerTest.php @@ -7,8 +7,9 @@ use OAuth2\Server; use OAuth2\GrantType\AuthorizationCode; use OAuth2\Request; use OAuth2\Response; +use PHPUnit\Framework\TestCase; -class ResourceControllerTest extends \PHPUnit_Framework_TestCase +class ResourceControllerTest extends TestCase { public function testNoAccessToken() { diff --git a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/TokenControllerTest.php b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/TokenControllerTest.php index 4a217bd55..d18eaa6d7 100644 --- a/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/TokenControllerTest.php +++ b/vendor/bshaffer/oauth2-server-php/test/OAuth2/Controller/TokenControllerTest.php @@ -10,8 +10,9 @@ use OAuth2\GrantType\UserCredentials; use OAuth2\Scope; use OAuth2\Request\TestRequest; use OAuth2\Response; +use PHPUnit\Framework\TestCase; -class TokenControllerTest extends \PHPUnit_Framework_TestCase +class TokenControllerTest extends TestCase { public function testNoGrantType() { @@ -271,6 +272,48 @@ class TokenControllerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($response->getParameter('error_description'), 'The request method must be POST when revoking an access token'); } + public function testCanUseCrossOriginRequestForRevoke() + { + $server = $this->getTestServer(); + + $request = new TestRequest(); + $request->setMethod('OPTIONS'); + + $server->handleRevokeRequest($request, $response = new Response()); + $this->assertTrue($response instanceof Response); + $this->assertEquals(200, $response->getStatusCode(), var_export($response, 1)); + $this->assertEquals($response->getHttpHeader('Allow'), 'POST, OPTIONS'); + } + + public function testInvalidRequestMethodForAccessToken() + { + $server = $this->getTestServer(); + + $request = new TestRequest(); + $request->setQuery(array( + 'token_type_hint' => 'access_token' + )); + + $server->handleTokenRequest($request, $response = new Response()); + $this->assertTrue($response instanceof Response); + $this->assertEquals(405, $response->getStatusCode(), var_export($response, 1)); + $this->assertEquals($response->getParameter('error'), 'invalid_request'); + $this->assertEquals($response->getParameter('error_description'), 'The request method must be POST when requesting an access token'); + } + + public function testCanUseCrossOriginRequestForAccessToken() + { + $server = $this->getTestServer(); + + $request = new TestRequest(); + $request->setMethod('OPTIONS'); + + $server->handleTokenRequest($request, $response = new Response()); + $this->assertTrue($response instanceof Response); + $this->assertEquals(200, $response->getStatusCode(), var_export($response, 1)); + $this->assertEquals($response->getHttpHeader('Allow'), 'POST, OPTIONS'); + } + public function testCreateController() { $storage = Bootstrap::getInstance()->getMemoryStorage(); |