You are here

public function FilteredStorageTest::testGetAllCollectionNamesFilter in Config Filter 8

Same name and namespace in other branches
  1. 8.2 src/Tests/FilteredStorageTest.php \Drupal\config_filter\Tests\FilteredStorageTest::testGetAllCollectionNamesFilter()

Test collection names from FilteredStorage::getAllCollectionNames().

File

src/Tests/FilteredStorageTest.php, line 120

Class

FilteredStorageTest
Tests StorageWrapper operations using the CachedStorage.

Namespace

Drupal\config_filter\Tests

Code

public function testGetAllCollectionNamesFilter() {
  $source = $this
    ->prophesize(StorageInterface::class);
  $source
    ->getAllCollectionNames()
    ->willReturn([
    'a',
    'b',
  ]);
  $filter = $this
    ->prophesizeFilter();
  $filter
    ->filterGetAllCollectionNames([
    'a',
    'b',
  ])
    ->willReturn([
    'b',
    'b',
    'c',
  ]);
  $storage = new FilteredStorage($source
    ->reveal(), [
    $filter
      ->reveal(),
  ]);
  $this
    ->assertEquals([
    'b',
    'c',
  ], $storage
    ->getAllCollectionNames());
}