function StorageTestBase::testRename

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php \Drupal\KernelTests\Core\KeyValueStore\StorageTestBase::testRename()
  2. 10 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 184

Class

StorageTestBase
Base class for testing key-value storages.

Namespace

Drupal\KernelTests\Core\KeyValueStore

Code

public function testRename() {
    $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.