summaryrefslogtreecommitdiffstats
path: root/Tests/Auth
diff options
context:
space:
mode:
authorJosh Hoyt <josh@janrain.com>2006-01-25 19:38:47 +0000
committerJosh Hoyt <josh@janrain.com>2006-01-25 19:38:47 +0000
commitfeb845ec2076eae9977e62ab6cb0d515b0074390 (patch)
tree603a405aeab3e38e03a13f9fe983160ed0cd87f4 /Tests/Auth
parenta462646c2bc7e5ef2c114040e16f0cf86423100c (diff)
downloadphp-openid-feb845ec2076eae9977e62ab6cb0d515b0074390.zip
php-openid-feb845ec2076eae9977e62ab6cb0d515b0074390.tar.gz
php-openid-feb845ec2076eae9977e62ab6cb0d515b0074390.tar.bz2
[project @ Add checkid_setup success server test]
Diffstat (limited to 'Tests/Auth')
-rw-r--r--Tests/Auth/OpenID/Server.php40
1 files changed, 25 insertions, 15 deletions
diff --git a/Tests/Auth/OpenID/Server.php b/Tests/Auth/OpenID/Server.php
index 59675fb..e75273d 100644
--- a/Tests/Auth/OpenID/Server.php
+++ b/Tests/Auth/OpenID/Server.php
@@ -170,15 +170,21 @@ class Tests_Auth_OpenID_Server extends PHPUnit_TestCase {
return $result;
}
- function test_checkIdImmediateFailure()
+ function _startAuth($mode, $authorized)
{
- $args = array('openid.mode' => 'checkid_immediate',
+ $args = array(
+ 'openid.mode' => $mode,
'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);
+ $ret = $this->server->getAuthResponse(&$ainfo, $authorized);
+ return $this->_parseRedirResp($ret);
+ }
+
+ function test_checkIdImmediateFailure()
+ {
+ list($base, $query) = $this->_startAuth('checkid_immediate', false);
$setup_args = array('openid.identity' => $this->id_url,
'openid.mode' => 'checkid_setup',
@@ -188,20 +194,14 @@ class Tests_Auth_OpenID_Server extends PHPUnit_TestCase {
$eargs = array('openid.mode' => 'id_res',
'openid.user_setup_url' => $setup_url);
- $expected = $this->_buildURL($this->rt_url, $eargs);
- $this->assertEquals($expected, $info);
+
+ $this->assertEquals($eargs, $query);
+ $this->assertEquals($this->rt_url, $base);
}
- function test_checkIdImmediate()
+ function _checkIDGood($mode)
{
- $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);
- $ret = $this->server->getAuthResponse(&$ainfo, true);
- list($base, $query) = $this->_parseRedirResp($ret);
+ list($base, $query) = $this->_startAuth($mode, true);
$this->assertEquals($base, $this->rt_url);
$this->assertEquals($query['openid.mode'], 'id_res');
$this->assertEquals($query['openid.identity'], $this->id_url);
@@ -218,4 +218,14 @@ class Tests_Auth_OpenID_Server extends PHPUnit_TestCase {
$expected64 = base64_encode($expected);
$this->assertEquals($expected64, $query['openid.sig']);
}
+
+ function test_checkIdImmediate()
+ {
+ $this->_checkIDGood('checkid_immediate');
+ }
+
+ function test_checkIdSetup()
+ {
+ $this->_checkIDGood('checkid_setup');
+ }
}