You are here

public function SplitFilterTest::testFilterCreateCollection in Configuration Split 8

Test that the filter creates collections correctly.

File

src/Tests/SplitFilterTest.php, line 472

Class

SplitFilterTest
Test filter plugin.

Namespace

Drupal\config_split\Tests

Code

public function testFilterCreateCollection() {
  $collection = $this
    ->randomMachineName();
  $collection_storage = new NullStorage();
  $storage = $this
    ->prophesize(StorageInterface::class);
  $storage
    ->createCollection($collection)
    ->willReturn($collection_storage);
  $transparent = $this
    ->getFilter(NULL);
  $this
    ->assertEquals($transparent, $transparent
    ->filterCreateCollection($collection));
  $filter = $this
    ->getFilter($storage
    ->reveal());
  $new_filter = $filter
    ->filterCreateCollection($collection);

  // Get the protected storage property.
  $internal = new \ReflectionProperty(SplitFilter::class, 'secondaryStorage');
  $internal
    ->setAccessible(TRUE);
  $actual = $internal
    ->getValue($new_filter);
  $this
    ->assertEquals($collection_storage, $actual);
}