From d9bf22a0e29c2a70049443a0ae8521a2c0492c8b Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 11 Dec 2011 06:38:23 -0500 Subject: initial commit for git repository --- .../Tests/Auth/OpenID/Association.php | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 models/openid-php-openid-782224d/Tests/Auth/OpenID/Association.php (limited to 'models/openid-php-openid-782224d/Tests/Auth/OpenID/Association.php') diff --git a/models/openid-php-openid-782224d/Tests/Auth/OpenID/Association.php b/models/openid-php-openid-782224d/Tests/Auth/OpenID/Association.php new file mode 100644 index 000000000..d65829682 --- /dev/null +++ b/models/openid-php-openid-782224d/Tests/Auth/OpenID/Association.php @@ -0,0 +1,54 @@ + + * @copyright 2005-2008 Janrain, Inc. + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache + */ + +require_once 'Auth/OpenID/Association.php'; + +class Tests_Auth_OpenID_Association extends PHPUnit_Framework_TestCase { + function test_me() + { + $issued = time(); + $lifetime = 600; + $assoc = new Auth_OpenID_Association('handle', 'secret', $issued, + $lifetime, 'HMAC-SHA1'); + $s = $assoc->serialize(); + $assoc2 = Auth_OpenID_Association::deserialize( + 'Auth_OpenID_Association', $s); + + if ($assoc2 === null) { + $this->fail('deserialize returned null'); + } else { + $this->assertTrue($assoc2->equal($assoc)); + } + } + function test_me256() + { + if(!Auth_OpenID_HMACSHA256_SUPPORTED) return; + $issued = time(); + $lifetime = 600; + $assoc = new Auth_OpenID_Association('handle', 'secret', $issued, + $lifetime, 'HMAC-SHA256'); + $s = $assoc->serialize(); + $assoc2 = Auth_OpenID_Association::deserialize( + 'Auth_OpenID_Association', $s); + + if ($assoc2 === null) { + $this->fail('deserialize returned null'); + } else { + $this->assertTrue($assoc2->equal($assoc)); + } + } +} + + -- cgit v1.2.3