From e903cbee684fe83f4bcd45e041e75131e08cb53a Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 5 Feb 2013 15:55:38 +0000 Subject: [PATCH] Update request class namespace --- src/OAuth2/AuthServer.php | 3 ++- tests/authentication/AuthServerTest.php | 34 ++++++++++++------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/OAuth2/AuthServer.php b/src/OAuth2/AuthServer.php index 19710b57..8bad1871 100644 --- a/src/OAuth2/AuthServer.php +++ b/src/OAuth2/AuthServer.php @@ -2,6 +2,7 @@ namespace OAuth2; +use OAuth2\Util\Request; use OAuth2\Util\SecureKey; use OAuth2\Storage\SessionInterface; use OAuth2\Storage\ClientInterface; @@ -122,7 +123,7 @@ class AuthServer * * @param RequestInterface The Request Object */ - public function setRequest(RequestInterface $request) + public function setRequest(Util\RequestInterface $request) { self::$request = $request; } diff --git a/tests/authentication/AuthServerTest.php b/tests/authentication/AuthServerTest.php index 54c29ab7..0ec7219d 100644 --- a/tests/authentication/AuthServerTest.php +++ b/tests/authentication/AuthServerTest.php @@ -101,7 +101,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase public function test_setRequest() { $a = $this->returnDefault(); - $request = new \OAuth2\Request(); + $request = new OAuth2\Util\Request(); $a->setRequest($request); $reflector = new ReflectionClass($a); @@ -109,17 +109,17 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $requestProperty->setAccessible(true); $v = $requestProperty->getValue(); - $this->assertTrue($v instanceof OAuth2\RequestInterface); + $this->assertTrue($v instanceof OAuth2\Util\RequestInterface); } public function test_getRequest() { $a = $this->returnDefault(); - $request = new OAuth2\Request(); + $request = new OAuth2\Util\Request(); $a->setRequest($request); $v = $a::getRequest(); - $this->assertTrue($v instanceof OAuth2\RequestInterface); + $this->assertTrue($v instanceof OAuth2\Util\RequestInterface); } public function test_getStorage() @@ -327,7 +327,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $_GET['response_type'] = 'code'; $_GET['scope'] = 'foo'; - $request = new OAuth2\Request($_GET); + $request = new OAuth2\Util\Request($_GET); $a->setRequest($request); $v = $a->checkAuthoriseParams(); @@ -581,7 +581,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $_POST['redirect_uri'] = 'http://foo/redirect'; $_POST['code'] = 'foobar'; - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(); @@ -617,7 +617,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $_POST['redirect_uri'] = 'http://foo/redirect'; $_POST['code'] = 'foobar'; - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(); @@ -641,7 +641,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $a = $this->returnDefault(); $a->addGrantType(new OAuth2\Grant\RefreshToken()); - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(array( @@ -658,7 +658,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $a = $this->returnDefault(); $a->addGrantType(new OAuth2\Grant\RefreshToken()); - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(array( @@ -678,7 +678,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $a = $this->returnDefault(); $a->addGrantType(new OAuth2\Grant\RefreshToken()); - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(array( @@ -699,7 +699,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $a = $this->returnDefault(); $a->addGrantType(new OAuth2\Grant\RefreshToken()); - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(array( @@ -722,7 +722,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $a = $this->returnDefault(); $a->addGrantType(new OAuth2\Grant\RefreshToken()); - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(array( @@ -756,7 +756,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $_POST['client_secret'] = 5678; $_POST['refresh_token'] = 'abcdef'; - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(); @@ -815,7 +815,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $a = $this->returnDefault(); $a->addGrantType(new OAuth2\Grant\ClientCredentials()); - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(array( @@ -832,7 +832,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $a = $this->returnDefault(); $a->addGrantType(new OAuth2\Grant\ClientCredentials()); - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(array( @@ -852,7 +852,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $a = $this->returnDefault(); $a->addGrantType(new OAuth2\Grant\ClientCredentials()); - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken(array( @@ -920,7 +920,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase $_POST['client_id'] = 1234; $_POST['client_secret'] = 5678; - $request = new OAuth2\Request(array(), $_POST); + $request = new OAuth2\Util\Request(array(), $_POST); $a->setRequest($request); $v = $a->issueAccessToken();