You are here

public function DeliveryCandidateTest::testAddRemoveNotifier in Message Subscribe 8

Test adding and removing flags.

@covers ::addNotifier @covers ::removeNotifier @covers ::getNotifiers @covers ::setNotifiers

File

tests/src/Unit/Subscribers/DeliveryCandidateTest.php, line 60

Class

DeliveryCandidateTest
Unit tests for the delivery candidate class.

Namespace

Drupal\Tests\message_subscribe\Unit\Subscribers

Code

public function testAddRemoveNotifier() {
  $candidate = new DeliveryCandidate([], [], 42);
  $this
    ->assertEmpty($candidate
    ->getNotifiers());
  $this
    ->assertInstanceOf(DeliveryCandidateInterface::class, $candidate
    ->addNotifier('foo'));
  $this
    ->assertEquals([
    'foo' => 'foo',
  ], $candidate
    ->getNotifiers());
  $this
    ->assertInstanceOf(DeliveryCandidateInterface::class, $candidate
    ->removeNotifier('foo'));
  $this
    ->assertEmpty($candidate
    ->getNotifiers());
  $this
    ->assertInstanceOf(DeliveryCandidateInterface::class, $candidate
    ->setNotifiers([
    'foo',
    'bar',
  ]));
  $this
    ->assertEquals([
    'foo' => 'foo',
    'bar' => 'bar',
  ], $candidate
    ->getNotifiers());
}