You are here

public function DigestTest::testDeliveryUnsavedOriginal in Message Digest 8

Test delivery without a saved original message entity.

@covers ::deliver

File

tests/src/Unit/Plugin/Notifier/DigestTest.php, line 118

Class

DigestTest
Tests the Digest plugin.

Namespace

Drupal\Tests\message_digest\Unit\Plugin\Notifier

Code

public function testDeliveryUnsavedOriginal() {

  // Setup an unsaved original message.
  $original = $this
    ->prophesize(MessageInterface::class)
    ->reveal();
  $message = $this
    ->prophesize(MessageInterface::class)
    ->reveal();
  $message->original_message = $original;
  $this
    ->expectException(\AssertionError::class);
  $this
    ->expectExceptionMessage('The message entity (or $message->original_message) must be saved in order to create a digest entry.');
  $notifier = $this
    ->getNotifier($message);
  $notifier
    ->deliver([]);
}