You are here

public function UuidFilterTest::testFilterNoParameter in Replication 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Plugin/ReplicationFilter/UuidFilterTest.php \Drupal\Tests\replication\Unit\Plugin\ReplicationFilter\UuidFilterTest::testFilterNoParameter()

Test filtering UUIDs with no parameter.

File

tests/src/Unit/Plugin/ReplicationFilter/UuidFilterTest.php, line 64

Class

UuidFilterTest
Tests that the uuid filter parses parameters correctly.

Namespace

Drupal\Tests\replication\Unit\Plugin\ReplicationFilter

Code

public function testFilterNoParameter() {

  // Use a mock builder for the class under test to eliminate the need to
  // mock all the dependencies. This is OK since the method under test is a
  // pure function, i.e. does not use the state createdy by the constructor.
  $filter = $this
    ->getMockBuilder(UuidFilter::class)
    ->disableOriginalConstructor()
    ->setMethods(NULL)
    ->getMock();
  $entity = $this
    ->getMock(EntityInterface::class);
  $entity
    ->method('uuid')
    ->willReturn('123');
  $value = $filter
    ->filter($entity, []);
  $this
    ->assertEquals(FALSE, $value);
}