summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBrent Shaffer <bshafs@gmail.com>2013-01-21 19:38:28 +0400
committerBrent Shaffer <bshafs@gmail.com>2013-01-21 19:38:28 +0400
commit8e2783f4e777faad6f4cef28c8376daef91f100b (patch)
tree55c1c62d58d54479c1898fe1b7df1b5da98309ab /test
parentb30ba04ce33b0fc8d4c5776cb06204ebafd04789 (diff)
downloadoauth2-server-php-8e2783f4e777faad6f4cef28c8376daef91f100b.tar.xz
adds tests for fix to #39
Diffstat (limited to 'test')
-rw-r--r--test/OAuth2/Server/Authorize/BasicValidationTest.php15
-rw-r--r--test/config/storage.json4
2 files changed, 19 insertions, 0 deletions
diff --git a/test/OAuth2/Server/Authorize/BasicValidationTest.php b/test/OAuth2/Server/Authorize/BasicValidationTest.php
index 57f0c8b..127b9fe 100644
--- a/test/OAuth2/Server/Authorize/BasicValidationTest.php
+++ b/test/OAuth2/Server/Authorize/BasicValidationTest.php
@@ -104,6 +104,21 @@ class OAuth2_Server_Authorize_BasicValidationTest extends PHPUnit_Framework_Test
$this->assertEquals($query['error_description'], 'The state parameter is required');
}
+ public function testValidateRedirectUri()
+ {
+ $server = $this->getTestServer();
+ $request = OAuth2_Request::createFromGlobals();
+ $request->query['client_id'] = 'Test Client ID with Redirect Uri'; // valid client id
+ $request->query['redirect_uri'] = 'http://adobe.com'; // invalid redirect URI
+ $request->query['response_type'] = 'code';
+ $response = $server->handleAuthorizeRequest($request, true);
+
+ $this->assertEquals($response->getStatusCode(), 400);
+
+ $this->assertEquals($response->getParameter('error'), 'redirect_uri_mismatch');
+ $this->assertEquals($response->getParameter('error_description'), 'The redirect URI provided is missing or does not match');
+ }
+
private function getTestServer($config = array())
{
$storage = OAuth2_Storage_Bootstrap::getInstance()->getMemoryStorage();
diff --git a/test/config/storage.json b/test/config/storage.json
index 5fd0849..8bd35e6 100644
--- a/test/config/storage.json
+++ b/test/config/storage.json
@@ -11,6 +11,10 @@
"client_credentials" : {
"Test Client ID": {
"secret": "TestSecret"
+ },
+ "Test Client ID with Redirect Uri": {
+ "secret": "TestSecret2",
+ "redirect_uri": "http://brentertainment.com"
}
},
"user_credentials" : {