summaryrefslogtreecommitdiffstats
path: root/Tests/Auth
diff options
context:
space:
mode:
authorJosh Hoyt <josh@janrain.com>2006-01-25 18:49:01 +0000
committerJosh Hoyt <josh@janrain.com>2006-01-25 18:49:01 +0000
commit4111c59710076807fc0300610e20238141d00b52 (patch)
treef7b3f6723b0878a18d5b7a12de9d040dd5130083 /Tests/Auth
parent473adb296aa90f916b6dc2ec0d7192387b1b01b1 (diff)
downloadphp-openid-4111c59710076807fc0300610e20238141d00b52.zip
php-openid-4111c59710076807fc0300610e20238141d00b52.tar.gz
php-openid-4111c59710076807fc0300610e20238141d00b52.tar.bz2
[project @ Added checkid_immediate server test]
Diffstat (limited to 'Tests/Auth')
-rw-r--r--Tests/Auth/OpenID/Server.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/Tests/Auth/OpenID/Server.php b/Tests/Auth/OpenID/Server.php
index 9426fc4..684f908 100644
--- a/Tests/Auth/OpenID/Server.php
+++ b/Tests/Auth/OpenID/Server.php
@@ -148,4 +148,37 @@ class Tests_Auth_OpenID_Server extends PHPUnit_TestCase {
$ra = Auth_OpenID_KVForm::kvToArray($info);
$this->assertKeyExists('error', $ra);
}
+
+ function _buildURL($base, $query)
+ {
+ $result = $base;
+ $div = '?';
+ foreach ($query as $k => $v) {
+ $result .= sprintf("%s%s=%s", $div, urlencode($k), urlencode($v));
+ $div = '&';
+ }
+ return $result;
+ }
+
+ function test_checkIdImmediateFailure()
+ {
+ $args = array('openid.mode' => 'checkid_immediate',
+ 'openid.identity' => $this->id_url,
+ 'openid.return_to' => $this->rt_url,
+ );
+ $ainfo = new Auth_OpenID_AuthorizationInfo($this->sv_url, $args);
+ list($status, $info) = $this->server->getAuthResponse(&$ainfo, false);
+ $this->assertEquals(Auth_OpenID_REDIRECT, $status);
+
+ $setup_args = array('openid.identity' => $this->id_url,
+ 'openid.mode' => 'checkid_setup',
+ 'openid.return_to' => $this->rt_url,
+ );
+ $setup_url = $this->_buildURL($this->sv_url, $setup_args);
+
+ $eargs = array('openid.mode' => 'id_res',
+ 'openid.user_setup_url' => $setup_url);
+ $expected = $this->_buildURL($this->rt_url, $eargs);
+ $this->assertEquals($expected, $info);
+ }
}