You are here

public function EmailNotifierTest::testEmailNotifier in Message Notify 8

Test that mails are properly sent.

File

tests/src/Functional/EmailNotifierTest.php, line 53

Class

EmailNotifierTest
Test the email notifier plugin.

Namespace

Drupal\Tests\message_notify\Functional

Code

public function testEmailNotifier() {
  $account = $this
    ->drupalCreateUser();
  $message = Message::create([
    'template' => $this->messageTemplate
      ->id(),
    'uid' => $account
      ->id(),
  ]);
  $this->messageNotifier
    ->send($message, [], 'email');
  $this
    ->assertMail('subject', 'first partial', 'Expected email subject sent');
  $this
    ->assertMail('body', "second partial\n\n", 'Expected email body sent');
}