Commit 716e8a83 authored by webchick's avatar webchick

Issue #1808544 by xjm: Use a more easily recognized arbitrary integer in k/v expiration tests :).

parent a964b7ae
......@@ -47,19 +47,19 @@ public function testCRUDWithExpiration() {
// Verify that an item can be stored with setWithExpire().
// Use a random expiration in each test.
$stores[0]->setWithExpire('foo', $this->objects[0], rand(500, 299792458));
$stores[0]->setWithExpire('foo', $this->objects[0], rand(500, 100000));
$this->assertIdenticalObject($this->objects[0], $stores[0]->get('foo'));
// Verify that the other collection is not affected.
$this->assertFalse($stores[1]->get('foo'));
// Verify that an item can be updated with setWithExpire().
$stores[0]->setWithExpire('foo', $this->objects[1], rand(500, 299792458));
$stores[0]->setWithExpire('foo', $this->objects[1], rand(500, 100000));
$this->assertIdenticalObject($this->objects[1], $stores[0]->get('foo'));
// Verify that the other collection is still not affected.
$this->assertFalse($stores[1]->get('foo'));
// Verify that the expirable data key is unique.
$stores[1]->setWithExpire('foo', $this->objects[2], rand(500, 299792458));
$stores[1]->setWithExpire('foo', $this->objects[2], rand(500, 100000));
$this->assertIdenticalObject($this->objects[1], $stores[0]->get('foo'));
$this->assertIdenticalObject($this->objects[2], $stores[1]->get('foo'));
......@@ -68,7 +68,7 @@ public function testCRUDWithExpiration() {
'foo' => $this->objects[3],
'bar' => $this->objects[4],
);
$stores[0]->setMultipleWithExpire($values, rand(500, 299792458));
$stores[0]->setMultipleWithExpire($values, rand(500, 100000));
$result = $stores[0]->getMultiple(array('foo', 'bar'));
foreach ($values as $j => $value) {
$this->assertIdenticalObject($value, $result[$j]);
......@@ -104,7 +104,7 @@ public function testCRUDWithExpiration() {
for ($i = 0; $i <= 1; $i++) {
// setWithExpireIfNotExists() should be TRUE the first time (when $i is
// 0) and FALSE the second time (when $i is 1).
$this->assertEqual(!$i, $stores[0]->setWithExpireIfNotExists($key, $this->objects[$i], rand(500, 299792458)));
$this->assertEqual(!$i, $stores[0]->setWithExpireIfNotExists($key, $this->objects[$i], rand(500, 100000)));
$this->assertIdenticalObject($this->objects[0], $stores[0]->get($key));
// Verify that the other collection is not affected.
$this->assertFalse($stores[1]->get($key));
......@@ -112,7 +112,7 @@ public function testCRUDWithExpiration() {
// Remove the item and try to set it again.
$stores[0]->delete($key);
$stores[0]->setWithExpireIfNotExists($key, $this->objects[1], rand(500, 299792458));
$stores[0]->setWithExpireIfNotExists($key, $this->objects[1], rand(500, 100000));
// This time it should succeed.
$this->assertIdenticalObject($this->objects[1], $stores[0]->get($key));
// Verify that the other collection is still not affected.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment