summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2008-06-06 21:39:33 +0000
committertailor <cygnus@janrain.com>2008-06-06 21:39:33 +0000
commitaa82a2ace4ca8675f3ac0b61b5fb27d3b35d01a9 (patch)
tree047da6610b630dba41f2dc34a9b2c754197f187d /Tests
parent2456aa518d9b4b3774aa71111c1edde0dac25808 (diff)
downloadphp-openid-aa82a2ace4ca8675f3ac0b61b5fb27d3b35d01a9.zip
php-openid-aa82a2ace4ca8675f3ac0b61b5fb27d3b35d01a9.tar.gz
php-openid-aa82a2ace4ca8675f3ac0b61b5fb27d3b35d01a9.tar.bz2
[project @ Do not send namespace aliases for extensions with OpenID 1 messages that we create]
This makes the library compatible with the 1.x series of this library, since it did not handle arbitrary query keys with dots in them (PHP mangles . to _)
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Auth/OpenID/Extension.php46
-rw-r--r--Tests/TestDriver.php1
2 files changed, 47 insertions, 0 deletions
diff --git a/Tests/Auth/OpenID/Extension.php b/Tests/Auth/OpenID/Extension.php
new file mode 100644
index 0000000..477110d
--- /dev/null
+++ b/Tests/Auth/OpenID/Extension.php
@@ -0,0 +1,46 @@
+<?php
+
+require_once 'PHPUnit.php';
+require_once 'Auth/OpenID/Message.php';
+require_once 'Auth/OpenID/Extension.php';
+
+class _ExtensionTest_DummyExtension extends Auth_OpenID_Extension {
+ var $ns_uri = 'http://an.extension/';
+ var $ns_alias = 'dummy';
+
+ function getExtensionArgs()
+ {
+ return array();
+ }
+}
+
+class Tests_Auth_OpenID_Extension extends PHPUnit_TestCase {
+ function test_OpenID1()
+ {
+ $oid1_msg = new Auth_OpenID_Message(Auth_OpenID_OPENID1_NS);
+ $ext = new _ExtensionTest_DummyExtension();
+ $ext->toMessage($oid1_msg);
+ $namespaces = $oid1_msg->namespaces;
+
+ $this->assertTrue($namespaces->isImplicit($ext->ns_uri));
+ $this->assertEquals($ext->ns_uri,
+ $namespaces->getNamespaceURI($ext->ns_alias));
+ $this->assertEquals($ext->ns_alias,
+ $namespaces->getAlias($ext->ns_uri));
+ }
+
+ function test_OpenID2()
+ {
+ $oid2_msg = new Auth_OpenID_Message(Auth_OpenID_OPENID2_NS);
+ $ext = new _ExtensionTest_DummyExtension();
+ $ext->toMessage($oid2_msg);
+ $namespaces = $oid2_msg->namespaces;
+ $this->assertFalse($namespaces->isImplicit($ext->ns_uri));
+ $this->assertEquals($ext->ns_uri,
+ $namespaces->getNamespaceURI($ext->ns_alias));
+ $this->assertEquals($ext->ns_alias,
+ $namespaces->getAlias($ext->ns_uri));
+ }
+}
+
+?> \ No newline at end of file
diff --git a/Tests/TestDriver.php b/Tests/TestDriver.php
index 602b9cf..71652dd 100644
--- a/Tests/TestDriver.php
+++ b/Tests/TestDriver.php
@@ -133,6 +133,7 @@ $_tests = array(
'CryptUtil',
'DiffieHellman',
'Discover_OpenID',
+ 'Extension',
'HMACSHA1',
'KVForm',
'Message',