You are here

public function StorageTestBase::testRename in Drupal 9

Same name and namespace in other branches
  1. 8 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 181

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'));
}