You are here

public function SplitFilterTest::testFilterGetAllCollectionNames in Configuration Split 8

Test that the filter gets collections names correctly.

File

src/Tests/SplitFilterTest.php, line 494

Class

SplitFilterTest
Test filter plugin.

Namespace

Drupal\config_split\Tests

Code

public function testFilterGetAllCollectionNames() {
  $collections = array_keys((array) $this
    ->getRandomGenerator()
    ->object(rand(3, 10)));
  $extra = array_keys((array) $this
    ->getRandomGenerator()
    ->object(rand(3, 10)));
  $storage = $this
    ->prophesize(StorageInterface::class);
  $storage
    ->getAllCollectionNames()
    ->willReturn($extra);
  $transparent = $this
    ->getFilter(NULL);
  $filter = $this
    ->getFilter($storage
    ->reveal());
  $this
    ->assertArrayEquals($collections, $transparent
    ->filterGetAllCollectionNames($collections));
  $this
    ->assertArrayEquals(array_merge($collections, $extra), $filter
    ->filterGetAllCollectionNames($collections));
}