You are here

public function SplitFilterTest::testFilterDeleteAll in Configuration Split 8

Test that the filter deletes all correctly.

File

src/Tests/SplitFilterTest.php, line 448

Class

SplitFilterTest
Test filter plugin.

Namespace

Drupal\config_split\Tests

Code

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

  // Test that the storage can throw an exception without affecting execution.
  $failing = $this
    ->prophesize(StorageInterface::class);
  $failing
    ->deleteAll('Yes')
    ->willThrow('\\UnexpectedValueException');
  $filter = $this
    ->getFilter($failing
    ->reveal());
  $this
    ->assertTrue($filter
    ->filterDeleteAll('Yes', TRUE));
}