Loading core/lib/Drupal/Core/KeyValueStore/MemoryStorage.php +4 −2 Original line number Diff line number Diff line Loading @@ -71,9 +71,11 @@ public function setMultiple(array $data) { * {@inheritdoc} */ public function rename($key, $new_key) { if ($key !== $new_key) { $this->data[$new_key] = $this->data[$key]; unset($this->data[$key]); } } /** * {@inheritdoc} Loading core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php +13 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,19 @@ public function testRename() { $this->assertNull($store->get('old')); } /** * Tests the rename operation. */ public function testRenameNoChange() { $stores = $this->createStorage(); $store = $stores[0]; $store->set('old', 'thing'); $this->assertSame($store->get('old'), 'thing'); $store->rename('old', 'old'); $this->assertSame($store->get('old'), 'thing'); } /** * Creates storage objects for each collection defined for this class. * Loading Loading
core/lib/Drupal/Core/KeyValueStore/MemoryStorage.php +4 −2 Original line number Diff line number Diff line Loading @@ -71,9 +71,11 @@ public function setMultiple(array $data) { * {@inheritdoc} */ public function rename($key, $new_key) { if ($key !== $new_key) { $this->data[$new_key] = $this->data[$key]; unset($this->data[$key]); } } /** * {@inheritdoc} Loading
core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php +13 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,19 @@ public function testRename() { $this->assertNull($store->get('old')); } /** * Tests the rename operation. */ public function testRenameNoChange() { $stores = $this->createStorage(); $store = $stores[0]; $store->set('old', 'thing'); $this->assertSame($store->get('old'), 'thing'); $store->rename('old', 'old'); $this->assertSame($store->get('old'), 'thing'); } /** * Creates storage objects for each collection defined for this class. * Loading