diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-12-11 06:38:23 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-12-11 06:38:23 -0500 |
commit | d9bf22a0e29c2a70049443a0ae8521a2c0492c8b (patch) | |
tree | c7599a9169d5def7df56c480ad6d67f312443d6f /models/openid-php-openid-782224d/Tests/Auth/OpenID/Extension.php | |
download | elgg-d9bf22a0e29c2a70049443a0ae8521a2c0492c8b.tar.gz elgg-d9bf22a0e29c2a70049443a0ae8521a2c0492c8b.tar.bz2 |
initial commit for git repository
Diffstat (limited to 'models/openid-php-openid-782224d/Tests/Auth/OpenID/Extension.php')
-rw-r--r-- | models/openid-php-openid-782224d/Tests/Auth/OpenID/Extension.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/models/openid-php-openid-782224d/Tests/Auth/OpenID/Extension.php b/models/openid-php-openid-782224d/Tests/Auth/OpenID/Extension.php new file mode 100644 index 000000000..35eb2f274 --- /dev/null +++ b/models/openid-php-openid-782224d/Tests/Auth/OpenID/Extension.php @@ -0,0 +1,44 @@ +<?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_Framework_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)); + } +} + |