function RecipeMultipleModulesConfigStorageTest::testCreateCollection

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Recipe/RecipeMultipleModulesConfigStorageTest.php \Drupal\Tests\Core\Recipe\RecipeMultipleModulesConfigStorageTest::testCreateCollection()

Tests createCollection() returns a new instance with the given collection.

File

core/tests/Drupal/Tests/Core/Recipe/RecipeMultipleModulesConfigStorageTest.php, line 283

Class

RecipeMultipleModulesConfigStorageTest
Tests RecipeMultipleModulesConfigStorage.

Namespace

Drupal\Tests\Core\Recipe

Code

public function testCreateCollection() : void {
  $storage = RecipeMultipleModulesConfigStorage::createFromModuleList([
    'system',
    'user',
  ], $this->extensionList);
  $collection = $storage->createCollection('test_collection');
  $this->assertInstanceOf(RecipeMultipleModulesConfigStorage::class, $collection);
  $this->assertSame('test_collection', $collection->getCollectionName());
  // Original storage retains its collection name.
  $this->assertSame(StorageInterface::DEFAULT_COLLECTION, $storage->getCollectionName());
}

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