diff --git a/core/lib/Drupal/Core/KeyValueStore/KeyValueStoreSortedSetInterface.php b/core/lib/Drupal/Core/KeyValueStore/KeyValueStoreSortedSetInterface.php index 2669256..4624ab3 100644 --- a/core/lib/Drupal/Core/KeyValueStore/KeyValueStoreSortedSetInterface.php +++ b/core/lib/Drupal/Core/KeyValueStore/KeyValueStoreSortedSetInterface.php @@ -6,9 +6,8 @@ * Defines the interface for sorted data in a key/value store. * * An example would be sequential log of data ordered by key of current time. - * A value would generally just exist once, but a key could be used multiple - * times for items in the same position in a sequence. This is based on the - * Redis Sorted Sets. + * A value can just exist once, but a key could be used multiple times for items + * in the same position in a sequence. This is based on the Redis sorted sets. */ interface KeyValueStoreSortedSetInterface { diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageSortedSetTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageSortedSetTest.php index 0bba558..034b322 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageSortedSetTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageSortedSetTest.php @@ -2,7 +2,6 @@ namespace Drupal\KernelTests\Core\KeyValueStore; -use Drupal\Core\Database\DatabaseExceptionWrapper; use Drupal\KernelTests\KernelTestBase; /** @@ -13,7 +12,7 @@ class DatabaseStorageSortedSetTest extends KernelTestBase { - static public $modules = array('system', 'serialization'); + static public $modules = ['system', 'serialization']; /** * @var string @@ -104,39 +103,42 @@ public function testCalls() { $key0 = $this->newKey(); $value0 = $this->randomMachineName(); $this->store->add($key0, $value0); - $this->assertPairs(array($key0 => $value0)); + $this->assertPairs([$key0 => $value0]); $key1 = $this->newKey(); $value1 = $this->randomMachineName(); $this->store->add($key1, $value1); - $this->assertPairs(array($key1 => $value1)); + $this->assertPairs([$key1 => $value1]); // Ensure it works to add sets with the same key. $key2 = $this->newKey(); $value2 = $this->randomMachineName(); $value3 = $this->randomMachineName(); $value4 = $this->randomMachineName(); - $this->store->addMultiple(array( - array($key2 => $value2), - array($key2 => $value3), - array($key2 => $value4), - )); + $this->store->addMultiple([ + [$key2 => $value2], + [$key2 => $value3], + [$key2 => $value4], + ]); $count = $this->store->getCount(); $this->assertEquals(5, $count, 'The count method returned correct count.'); $value = $this->store->getRange($key1, $key2); - $this->assertSame($value, array($value1, $value2, $value3, $value4)); + $this->assertSame($value, [$value1, $value2, $value3, $value4]); + + $value = $this->store->getRange($key1); + $this->assertSame($value, [$value1, $value2, $value3, $value4]); $new1 = $this->newKey(); $this->store->add($new1, $value1); $value = $this->store->getRange($new1, $new1); - $this->assertSame($value, array($value1), 'Value was successfully updated.'); + $this->assertSame($value, [$value1], 'Value was successfully updated.'); $this->assertRecords(5, 'Correct number of record in the collection after value update.'); $value = $this->store->getRange($key1, $key1); - $this->assertSame($value, array(), 'Non-existing range returned empty array.'); + $this->assertSame($value, [], 'Non-existing range returned empty array.'); $max_key = $this->store->getMaxKey(); $this->assertEquals($max_key, $new1, 'The getMaxKey method returned correct key.');