Skip to content
Snippets Groups Projects
Commit 716e8a83 authored by Angie Byron's avatar Angie Byron
Browse files

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

parent a964b7ae
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment