function RecipeConfigStorageWrapperTest::testGetAllCollectionNames

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Recipe/RecipeConfigStorageWrapperTest.php \Drupal\Tests\Core\Recipe\RecipeConfigStorageWrapperTest::testGetAllCollectionNames()

Test that we merge and return only unique collection names.

File

core/tests/Drupal/Tests/Core/Recipe/RecipeConfigStorageWrapperTest.php, line 262

Class

RecipeConfigStorageWrapperTest
@coversDefaultClass \Drupal\Core\Recipe\RecipeConfigStorageWrapper @group Recipe

Namespace

Drupal\Tests\Core\Recipe

Code

public function testGetAllCollectionNames() : void {
    $a = $this->createMock(StorageInterface::class);
    $a->expects($this->once())
        ->method('getAllCollectionNames')
        ->willReturn([
        'collection_1',
        'collection_2',
    ]);
    $b = $this->createMock(StorageInterface::class);
    $b->expects($this->once())
        ->method('getAllCollectionNames')
        ->willReturn([
        'collection_3',
        'collection_1',
        'collection_2',
    ]);
    $storage = new RecipeConfigStorageWrapper($a, $b);
    $this->assertEquals([
        'collection_1',
        'collection_2',
        'collection_3',
    ], $storage->getAllCollectionNames());
}

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