diff options
Diffstat (limited to 'Tests/Auth')
-rw-r--r-- | Tests/Auth/OpenID/MemStore.php | 26 | ||||
-rw-r--r-- | Tests/Auth/OpenID/StoreTest.php | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Tests/Auth/OpenID/MemStore.php b/Tests/Auth/OpenID/MemStore.php index c9141f7..35f6a77 100644 --- a/Tests/Auth/OpenID/MemStore.php +++ b/Tests/Auth/OpenID/MemStore.php @@ -20,6 +20,32 @@ class Tests_Auth_OpenID_MemStore extends Auth_OpenID_OpenIDStore { return serialize(array($server_url, $handle)); } + function getBest($assoc_list) + { + $best = null; + foreach ($assoc_list as $assoc) { + if (($best === null) || + ($best->issued < $assoc->issued)) { + $best = $assoc; + } + } + return $best; + } + + function getExpired() + { + $expired = array(); + foreach ($this->assocs as $url => $assocs) { + $best = $this->getBest($assocs); + if (($best === null) || + ($best->getExpiresIn() == 0)) { + $expired[] = $server_url; + } + } + + return $expired; + } + function getAssocPairs() { $pairs = array(); diff --git a/Tests/Auth/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php index a07255b..195a531 100644 --- a/Tests/Auth/OpenID/StoreTest.php +++ b/Tests/Auth/OpenID/StoreTest.php @@ -123,6 +123,7 @@ class Tests_Auth_OpenID_StoreTest extends PHPUnit_TestCase { */ function _testStore($store) { + $this->assertTrue($store->getExpired() === array()); // Association functions $now = time(); |