function StorageTestBase::testRename

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php \Drupal\KernelTests\Core\KeyValueStore\StorageTestBase::testRename()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php \Drupal\KernelTests\Core\KeyValueStore\StorageTestBase::testRename()
  3. 11.x core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php \Drupal\KernelTests\Core\KeyValueStore\StorageTestBase::testRename()

Tests the rename operation.

File

core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php, line 186

Class

StorageTestBase
Base class for testing key-value storages.

Namespace

Drupal\KernelTests\Core\KeyValueStore

Code

public function testRename() : void {
  $stores = $this->createStorage();
  $store = $stores[0];
  $store->set('old', 'thing');
  $this->assertSame('thing', $store->get('old'));
  $store->rename('old', 'new');
  $this->assertSame('thing', $store->get('new'));
  $this->assertNull($store->get('old'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.