You are here

public function StorageReplaceDataWrapperTest::testCreateCollection in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php \Drupal\KernelTests\Core\Config\Storage\StorageReplaceDataWrapperTest::testCreateCollection()

Tests if new collections created correctly.

@dataProvider providerCollections

Parameters

string $collection: The collection name.

File

core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php, line 69

Class

StorageReplaceDataWrapperTest
Tests StorageReplaceDataWrapper operations.

Namespace

Drupal\KernelTests\Core\Config\Storage

Code

public function testCreateCollection($collection) {
  $initial_collection_name = $this->storage
    ->getCollectionName();

  // Create new storage with given collection and check it is set correctly.
  $new_storage = $this->storage
    ->createCollection($collection);
  $this
    ->assertSame($collection, $new_storage
    ->getCollectionName());

  // Check collection not changed in the current storage instance.
  $this
    ->assertSame($initial_collection_name, $this->storage
    ->getCollectionName());
}