You are here

public function SplitFilterTest::testFilterExists in Configuration Split 8

Test that the filter checks existence correctly.

File

src/Tests/SplitFilterTest.php, line 371

Class

SplitFilterTest
Test filter plugin.

Namespace

Drupal\config_split\Tests

Code

public function testFilterExists() {
  $storage = $this
    ->prophesize(StorageInterface::class);
  $storage
    ->exists('Yes')
    ->willReturn(TRUE);
  $storage
    ->exists('No')
    ->willReturn(FALSE);
  $transparent = $this
    ->getFilter(NULL);
  $filter = $this
    ->getFilter($storage
    ->reveal());
  $this
    ->assertTrue($transparent
    ->filterExists('Yes', TRUE));
  $this
    ->assertTrue($transparent
    ->filterExists('No', TRUE));
  $this
    ->assertFalse($transparent
    ->filterExists('Yes', FALSE));
  $this
    ->assertFalse($transparent
    ->filterExists('No', FALSE));
  $this
    ->assertTrue($filter
    ->filterExists('Yes', TRUE));
  $this
    ->assertTrue($filter
    ->filterExists('No', TRUE));
  $this
    ->assertTrue($filter
    ->filterExists('Yes', FALSE));
  $this
    ->assertFalse($filter
    ->filterExists('No', FALSE));
}