diff options
author | tailor <dag@janrain.com> | 2008-06-04 22:14:08 +0000 |
---|---|---|
committer | tailor <dag@janrain.com> | 2008-06-04 22:14:08 +0000 |
commit | 9329fbee6bb25ecb98b9091141caf299fc8ed4cf (patch) | |
tree | 45c2862ab25a92e48286a09870f86684236f1d19 /Tests | |
parent | c4f6fa72b6771e1e8c392b341145dfa953cb0dca (diff) | |
download | php-openid-9329fbee6bb25ecb98b9091141caf299fc8ed4cf.zip php-openid-9329fbee6bb25ecb98b9091141caf299fc8ed4cf.tar.gz php-openid-9329fbee6bb25ecb98b9091141caf299fc8ed4cf.tar.bz2 |
[project @ Message->getArg & friends return FailureResponse on error]
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Auth/OpenID/AssociationResponse.php | 5 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Message.php | 31 |
2 files changed, 22 insertions, 14 deletions
diff --git a/Tests/Auth/OpenID/AssociationResponse.php b/Tests/Auth/OpenID/AssociationResponse.php index 285577f..da80d15 100644 --- a/Tests/Auth/OpenID/AssociationResponse.php +++ b/Tests/Auth/OpenID/AssociationResponse.php @@ -303,8 +303,9 @@ class TestInvalidFields extends Tests_Auth_OpenID_AssociationResponse { { // Invalid value for expires_in should cause failure $this->assoc_response->setArg(Auth_OpenID_OPENID_NS, 'expires_in', 'forever'); - $this->assertTrue($this->consumer->_extractAssociation( - $this->assoc_response, $this->assoc_session) === null); + $assoc = $this->consumer->_extractAssociation($this->assoc_response, + $this->assoc_session); + $this->assertTrue(Auth_OpenID::isFailure($assoc)); } } diff --git a/Tests/Auth/OpenID/Message.php b/Tests/Auth/OpenID/Message.php index 325bce9..e19a69c 100644 --- a/Tests/Auth/OpenID/Message.php +++ b/Tests/Auth/OpenID/Message.php @@ -17,9 +17,8 @@ class MessageTest extends PHPUnit_TestCase { if ($expected === null) { $this->assertEquals( $this->msg->getArg($ns, $key, $a_default), $a_default); - $this->assertEquals( - $this->msg->getArg($ns, $key, Auth_OpenID_NO_DEFAULT), - null); + $result = $this->msg->getArg($ns, $key, Auth_OpenID_NO_DEFAULT); + $this->assertTrue(Auth_OpenID::isFailure($result)); } else { $this->assertEquals( $this->msg->getArg($ns, $key, $a_default), $expected); @@ -69,7 +68,11 @@ class Tests_Auth_OpenID_EmptyMessage extends MessageTest { function test_getKeyOpenID() { - $this->assertEquals($this->msg->getKey(Auth_OpenID_OPENID_NS, 'foo'), null); + $key = $this->msg->getKey(Auth_OpenID_OPENID_NS, 'foo'); + $this->assertTrue(Auth_OpenID::isFailure($key)); + $this->msg->setOpenIDNamespace(); + $key = $this->msg->getKey(Auth_OpenID_OPENID_NS, 'foo'); + $this->assertEquals('openid.foo', $key); } function test_getKeyBARE() @@ -121,12 +124,14 @@ class Tests_Auth_OpenID_EmptyMessage extends MessageTest { function test_getArg() { - $this->assertEquals($this->msg->getArg(Auth_OpenID_OPENID_NS, 'foo'), null); + $result = $this->msg->getArg(Auth_OpenID_OPENID_NS, 'foo'); + $this->assertTrue(Auth_OpenID::isFailure($result)); } function test_getArgs() { - $this->assertEquals($this->msg->getArgs(Auth_OpenID_OPENID_NS), array()); + $result = $this->msg->getArgs(Auth_OpenID_OPENID_NS); + $this->assertTrue(Auth_OpenID::isFailure($result)); } function test_getArgsBARE() @@ -151,8 +156,9 @@ class Tests_Auth_OpenID_EmptyMessage extends MessageTest { function test_updateArgs() { - $this->assertEquals($this->msg->updateArgs(Auth_OpenID_OPENID_NS, - array('does not' => 'matter')), false); + $result= $this->msg->updateArgs(Auth_OpenID_OPENID_NS, + array('does not' => 'matter')); + $this->assertTrue(Auth_OpenID::isFailure($result)); } function _test_updateArgsNS($ns) @@ -188,8 +194,9 @@ class Tests_Auth_OpenID_EmptyMessage extends MessageTest { function test_setArg() { - $this->assertEquals($this->msg->setArg(Auth_OpenID_OPENID_NS, - 'does not', 'matter'), false); + $result = $this->msg->setArg(Auth_OpenID_OPENID_NS, + 'does not', 'matter'); + $this->assertTrue(Auth_OpenID::isFailure($result)); } function _test_setArgNS($ns) @@ -223,8 +230,8 @@ class Tests_Auth_OpenID_EmptyMessage extends MessageTest { function test_delArg() { - $this->assertEquals($this->msg->delArg(Auth_OpenID_OPENID_NS, - 'does not'), false); + $result = $this->msg->delArg(Auth_OpenID_OPENID_NS, 'does not'); + $this->assertTrue(Auth_OpenID::isFailure($result)); } function _test_delArgNS($ns) |