You are here

public function MessageNotifyUiTest::testMessageNotifyUi in Message UI 8

Testing the displaying of the preview.

File

tests/src/Functional/MessageNotifyUiTest.php, line 35

Class

MessageNotifyUiTest
Testing the message notify button.

Namespace

Drupal\Tests\message_ui\Functional

Code

public function testMessageNotifyUi() {

  // User login.
  $this
    ->drupalLogin($this->account);

  // Create a message.
  $message = $this->container
    ->get('entity_type.manager')
    ->getStorage('message')
    ->create([
    'template' => 'foo',
  ]);
  $message
    ->save();

  // Go to the page of notify page.
  $edit = [
    'use_custom' => TRUE,
    'email' => 'foo@gmail.com',
  ];
  $this
    ->drupalPostForm('message/' . $message
    ->id() . '/notify', $edit, t('Notify'));
  $this
    ->assertSession()
    ->pageTextContains('The email sent successfully.');
}