diff --git a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageExpirableTest.php b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageExpirableTest.php index 7b592be..b173445 100644 --- a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageExpirableTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageExpirableTest.php @@ -44,21 +44,20 @@ protected function tearDown() { */ public function testCRUDWithExpiration() { // Verify that an item can be stored with setWithExpire(). - $expire = 604800; - $this->verbose($expire); - $this->store1->setWithExpire('foo', $this->objects[0], $expire); + // Use a random expiration in each test. + $this->store1->setWithExpire('foo', $this->objects[0], rand(500, 299792458)); $this->assertIdenticalObject($this->objects[0], $this->store1->get('foo')); // Verify that the other collection is not affected. $this->assertFalse($this->store2->get('foo')); // Verify that an item can be updated with setWithExpire(). - $this->store1->setWithExpire('foo', $this->objects[1], $expire); + $this->store1->setWithExpire('foo', $this->objects[1], rand(500, 299792458)); $this->assertIdenticalObject($this->objects[1], $this->store1->get('foo')); // Verify that the other collection is still not affected. $this->assertFalse($this->store2->get('foo')); // Verify that the expirable data key is unique. - $this->store2->setWithExpire('foo', $this->objects[2], $expire); + $this->store2->setWithExpire('foo', $this->objects[2], rand(500, 299792458)); $this->assertIdenticalObject($this->objects[1], $this->store1->get('foo')); $this->assertIdenticalObject($this->objects[2], $this->store2->get('foo')); @@ -67,7 +66,7 @@ public function testCRUDWithExpiration() { 'foo' => $this->objects[3], 'bar' => $this->objects[4], ); - $this->store1->setMultipleWithExpire($values, $expire); + $this->store1->setMultipleWithExpire($values, rand(500, 299792458)); $result = $this->store1->getMultiple(array('foo', 'bar')); foreach ($values as $j => $value) { $this->assertIdenticalObject($value, $result[$j]); @@ -101,9 +100,9 @@ public function testCRUDWithExpiration() { // Test that setWithExpireIfNotExists() succeeds only the first time. $key = $this->randomName(); for ($i = 0; $i <= 1; $i++) { - // setIfNotExists() should be TRUE the first time (when $i is 0) and - // FALSE the second time (when $i is 1). - $this->assertEqual(!$i, $this->store1->setWithExpireIfNotExists($key, $this->objects[$i], $expire)); + // setWithExpireIfNotExists() should be TRUE the first time (when $i is + // 0) and FALSE the second time (when $i is 1). + $this->assertEqual(!$i, $this->store1->setWithExpireIfNotExists($key, $this->objects[$i], rand(500, 299792458))); $this->assertIdenticalObject($this->objects[0], $this->store1->get($key)); // Verify that the other collection is not affected. $this->assertFalse($this->store2->get($key)); @@ -111,7 +110,7 @@ public function testCRUDWithExpiration() { // Remove the item and try to set it again. $this->store1->delete($key); - $this->store1->setIfNotExists($key, $this->objects[1]); + $this->store1->setWithExpireIfNotExists($key, $this->objects[1], rand(500, 299792458)); // This time it should succeed. $this->assertIdenticalObject($this->objects[1], $this->store1->get($key)); // Verify that the other collection is still not affected. diff --git a/core/modules/user/lib/Drupal/user/TempStore.php b/core/modules/user/lib/Drupal/user/TempStore.php index 9ebde36..c8a6dd1 100644 --- a/core/modules/user/lib/Drupal/user/TempStore.php +++ b/core/modules/user/lib/Drupal/user/TempStore.php @@ -23,8 +23,8 @@ * elsewhere, e.g. autosave data, multistep forms, or in-progress changes * to complex configuration that are not ready to be saved. * - * Each TempStore belongs belongs to a particular owner (e.g. a user, session, - * or process). Multiple owners may use the same key/value collection, and the + * Each TempStore belongs to a particular owner (e.g. a user, session, or + * process). Multiple owners may use the same key/value collection, and the * owner is stored along with the key/value pair. * * Every key is unique within the collection, so the TempStore can check diff --git a/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php b/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php index b0ef393..362e739 100644 --- a/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php @@ -94,7 +94,8 @@ public function testUserTempStore() { $key = $this->randomName(); // Test that setIfNotExists() succeeds only the first time. for ($i = 0; $i <= 1; $i++) { - // setIfNotExists() should fail the second time ($i = 1). + // setIfNotExists() should be TRUE the first time (when $i is 0) and + // FALSE the second time (when $i is 1). $this->assertEqual(!$i, $this->stores[0]->setIfNotExists($key, $this->objects[$i])); $metadata = $this->stores[0]->getMetadata($key); $this->assertEqual($this->users[0], $metadata->owner);