You are here

public function SplitFilterTest::testFilterReadMultiple in Configuration Split 8

Test that the filter reads multiple objects correctly.

File

src/Tests/SplitFilterTest.php, line 411

Class

SplitFilterTest
Test filter plugin.

Namespace

Drupal\config_split\Tests

Code

public function testFilterReadMultiple() {

  // Set up random config storage.
  $primary = (array) $this
    ->getRandomGenerator()
    ->object(rand(3, 10));
  $secondary = (array) $this
    ->getRandomGenerator()
    ->object(rand(3, 10));
  $merged = array_merge($primary, $secondary);
  $storage = $this
    ->prophesize(StorageInterface::class);
  $storage
    ->readMultiple(Argument::cetera())
    ->willReturn($secondary);
  $transparent = $this
    ->getFilter(NULL);
  $filter = $this
    ->getFilter($storage
    ->reveal());

  // Test listing config.
  $this
    ->assertArrayEquals($primary, $transparent
    ->filterReadMultiple(array_keys($merged), $primary));
  $this
    ->assertArrayEquals($merged, $filter
    ->filterReadMultiple(array_keys($merged), $primary));
}