diff options
author | tailor <cygnus@janrain.com> | 2007-03-02 19:46:21 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2007-03-02 19:46:21 +0000 |
commit | 02553fb670e86d7310328e85fcd4e122403117cc (patch) | |
tree | 883373ef26b4cebead4d546e2c480ff88c7217f4 | |
parent | bad7b0b850398b22e94853653e2a9d29c10113b1 (diff) | |
download | php-openid-02553fb670e86d7310328e85fcd4e122403117cc.zip php-openid-02553fb670e86d7310328e85fcd4e122403117cc.tar.gz php-openid-02553fb670e86d7310328e85fcd4e122403117cc.tar.bz2 |
[project @ Remove isDumb from store interface]
-rw-r--r-- | Auth/OpenID/Consumer.php | 2 | ||||
-rw-r--r-- | Auth/OpenID/DumbStore.php | 9 | ||||
-rw-r--r-- | Auth/OpenID/Interface.php | 17 | ||||
-rw-r--r-- | Tests/Auth/OpenID/StoreTest.php | 19 |
4 files changed, 6 insertions, 41 deletions
diff --git a/Auth/OpenID/Consumer.php b/Auth/OpenID/Consumer.php index e23fcbe..b944252 100644 --- a/Auth/OpenID/Consumer.php +++ b/Auth/OpenID/Consumer.php @@ -547,7 +547,7 @@ class Auth_OpenID_GenericConsumer { { $this->store =& $store; $this->negotiator =& Auth_OpenID_getDefaultNegotiator(); - $this->_use_assocs = !($this->store && $this->store->isDumb()); + $this->_use_assocs = ($this->store ? true : false); $this->fetcher = Services_Yadis_Yadis::getHTTPFetcher(); diff --git a/Auth/OpenID/DumbStore.php b/Auth/OpenID/DumbStore.php index ce6e67f..ef1a37f 100644 --- a/Auth/OpenID/DumbStore.php +++ b/Auth/OpenID/DumbStore.php @@ -95,15 +95,6 @@ class Auth_OpenID_DumbStore extends Auth_OpenID_OpenIDStore { { return $this->auth_key; } - - /** - * This store is a dumb mode store, so this method is overridden - * to return true. - */ - function isDumb() - { - return true; - } } ?>
\ No newline at end of file diff --git a/Auth/OpenID/Interface.php b/Auth/OpenID/Interface.php index 0b71f45..33e9797 100644 --- a/Auth/OpenID/Interface.php +++ b/Auth/OpenID/Interface.php @@ -133,23 +133,6 @@ class Auth_OpenID_OpenIDStore { } /** - * This method must return true if the store is a dumb-mode-style - * store. Unlike all other methods in this class, this one - * provides a default implementation, which returns false. - * - * In general, any custom subclass of {@link Auth_OpenID_OpenIDStore} - * won't override this method, as custom subclasses are only likely to - * be created when the store is fully functional. - * - * @return bool true if the store works fully, false if the - * consumer will have to use dumb mode to use this store. - */ - function isDumb() - { - return false; - } - - /** * Removes all entries from the store; implementation is optional. */ function reset() diff --git a/Tests/Auth/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php index 32f13d3..a07255b 100644 --- a/Tests/Auth/OpenID/StoreTest.php +++ b/Tests/Auth/OpenID/StoreTest.php @@ -98,26 +98,18 @@ class Tests_Auth_OpenID_StoreTest extends PHPUnit_TestCase { function _checkRetrieve(&$store, $url, $handle, $expected, $name = null) { $retrieved_assoc = $store->getAssociation($url, $handle); - if (($expected === null) || ($store->isDumb())) { - $this->assertNull($retrieved_assoc, "Retrieved association " . - "was non-null"); + if ($expected === null) { + $this->assertTrue($retrieved_assoc === null); } else { - if ($retrieved_assoc === null) { - $this->fail("$name: Got null when expecting " . - $expected->serialize()); - } else { - $this->assertEquals($expected->serialize(), - $retrieved_assoc->serialize(), $name); - } + $this->assertTrue($expected->equal($retrieved_assoc), $name); } } function _checkRemove(&$store, $url, $handle, $expected, $name = null) { $present = $store->removeAssociation($url, $handle); - $expectedPresent = (!$store->isDumb() && $expected); - $this->assertTrue((!$expectedPresent && !$present) || - ($expectedPresent && $present), + $this->assertTrue((!$expected && !$present) || + ($expected && $present), $name); } @@ -293,7 +285,6 @@ explicitly'); { list($stamp, $salt) = Auth_OpenID_splitNonce($nonce); $actual = $store->useNonce($server_url, $stamp, $salt); - $expected = $store->isDumb() || $expected; $val = ($actual && $expected) || (!$actual && !$expected); $this->assertTrue($val, "_checkUseNonce failed: $msg"); } |