summaryrefslogtreecommitdiffstats
path: root/Tests/Auth/OpenID
diff options
context:
space:
mode:
authorJosh Hoyt <josh@janrain.com>2006-01-25 12:53:08 +0000
committerJosh Hoyt <josh@janrain.com>2006-01-25 12:53:08 +0000
commit741375480ccf6eba20ebbb3c1d77deb508cd000d (patch)
treed933a0972fa40d10ccd8da39430f285886b9dc1d /Tests/Auth/OpenID
parentade65302208188976e5342de921612ebb94f47ee (diff)
downloadphp-openid-741375480ccf6eba20ebbb3c1d77deb508cd000d.zip
php-openid-741375480ccf6eba20ebbb3c1d77deb508cd000d.tar.gz
php-openid-741375480ccf6eba20ebbb3c1d77deb508cd000d.tar.bz2
[project @ Plain-text association server test and associated fixes]
Diffstat (limited to 'Tests/Auth/OpenID')
-rw-r--r--Tests/Auth/OpenID/Server.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/Tests/Auth/OpenID/Server.php b/Tests/Auth/OpenID/Server.php
index 87d7e92..bdd119a 100644
--- a/Tests/Auth/OpenID/Server.php
+++ b/Tests/Auth/OpenID/Server.php
@@ -89,4 +89,30 @@ class Tests_Auth_OpenID_Server extends PHPUnit_TestCase {
$resultArgs = Auth_OpenID_KVForm::kvToArray($info);
$this->assertTrue(array_key_exists('error', $resultArgs));
}
+
+ function assertKeyExists($key, $ary)
+ {
+ $this->assertTrue(array_key_exists($key, $ary),
+ "Failed to find $key in $ary");
+ }
+
+ function assertKeyAbsent($key, $ary)
+ {
+ $this->assertFalse(array_key_exists($key, $ary),
+ "Unexpectedly found $key in $ary");
+ }
+
+ function test_associatePlain()
+ {
+ list($status, $info) = $this->server->associate(array());
+
+ $this->assertEquals(Auth_OpenID_REMOTE_OK, $status);
+ $ra = Auth_OpenID_KVForm::kvToArray($info);
+ $this->assertEquals('HMAC-SHA1', $ra['assoc_type']);
+ $this->assertKeyAbsent('session_type', $ra);
+ $this->assertKeyExists('assoc_handle', $ra);
+ $this->assertKeyExists('mac_key', $ra);
+ $exp = (integer)$ra['expires_in'];
+ $this->assertTrue($exp > 0);
+ }
}