You are here

public function EmailTest::testSendNoEmail in Message Notify 8

Test sending without an email.

@covers ::deliver

File

tests/src/Unit/Plugin/Notifier/EmailTest.php, line 134

Class

EmailTest
Unit tests for the Email notifier.

Namespace

Drupal\Tests\message_notify\Unit\Plugin\Notifier

Code

public function testSendNoEmail() {
  $this
    ->expectException(MessageNotifyException::class);
  $this
    ->expectExceptionMessage('It is not possible to send a Message to an anonymous owner. You may set an owner using ::setOwner() or pass a "mail" to the $options array.');
  $message = $this
    ->prophesize(MessageInterface::class);
  $account = $this
    ->prophesize(UserInterface::class)
    ->reveal();
  $message
    ->getOwner()
    ->willReturn($account);
  $notifier = $this
    ->getNotifier($message
    ->reveal());
  $notifier
    ->deliver([]);
}