abstract protected function getStore();
/**
* Tests the store automatically delete the key when it expire.
*
* This test is time-sensitive: the $clockDelay could be adjusted.
*/
public function testExpiration() { $key =
new Key(uniqid(__METHOD__, true
));
$clockDelay =
$this->
getClockDelay();
/** @var PersistingStoreInterface $store */
$store =
$this->
getStore();
$store->
save($key);
$store->
putOffExpiration($key, 2 *
$clockDelay / 1000000
);
$this->
assertTrue($store->
exists($key));
usleep(3 *
$clockDelay);
$this->
assertFalse($store->
exists($key));
}