function ReadOnlyStorageTest::testCollections
Tests collections.
@legacy-covers ::getAllCollectionNames @legacy-covers ::getCollectionName @legacy-covers ::createCollection
File
- 
              core/tests/ Drupal/ Tests/ Core/ Config/ ReadOnlyStorageTest.php, line 154 
Class
Namespace
Drupal\Tests\Core\ConfigCode
public function testCollections() : void {
  $fixture = [
    StorageInterface::DEFAULT_COLLECTION => [
      $this->randomMachineName(),
    ],
    'A' => [
      $this->randomMachineName(),
    ],
    'B' => [
      $this->randomMachineName(),
    ],
    'C' => [
      $this->randomMachineName(),
    ],
  ];
  $this->setRandomFixtureConfig($fixture);
  $this->assertEquals([
    'A',
    'B',
    'C',
  ], $this->storage
    ->getAllCollectionNames());
  foreach (array_keys($fixture) as $collection) {
    $storage = $this->storage
      ->createCollection($collection);
    // Assert that the collection storage is still a read-only storage.
    $this->assertInstanceOf(ReadOnlyStorage::class, $storage);
    $this->assertEquals($collection, $storage->getCollectionName());
  }
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
