public function MessageNotifyTest::testDeliver in Message Notify 8
Test send method.
Check the correct info is sent to delivery.
File
- tests/
src/ Kernel/ MessageNotifyTest.php, line 75
Class
- MessageNotifyTest
- Test the Message notifier plugins handling.
Namespace
Drupal\Tests\message_notify\KernelCode
public function testDeliver() {
$message = Message::create([
'template' => $this->messageTemplate
->id(),
]);
$message->message_text_another = 'another field';
$this->messageNotifier
->send($message, [], 'test');
// The test notifier added the output to the message.
$output = $message->output;
$text = $message
->getText();
$this
->assertContains((string) $text[1], (string) $output['foo']);
$this
->assertContains('another field', (string) $output['foo']);
$this
->assertContains((string) $text[0], (string) $output['bar']);
$this
->assertNotContains('another field', (string) $output['bar']);
}