You are here

public function MailUiTest::testNotice in Maillog / Mail Developer 8

Checks the drupal_set_message() for disabled mail sending.

File

tests/src/Functional/MailUiTest.php, line 89

Class

MailUiTest
Tests the maillog plugin user interface.

Namespace

Drupal\Tests\maillog\Functional

Code

public function testNotice() {

  // Create a user with valid permissions and a recipient for a message.
  $recipient = $this
    ->drupalCreateUser();
  $permissions = [
    'access user contact forms',
    'access user profiles',
    'administer maillog',
  ];
  $this
    ->drupalLogin($this
    ->drupalCreateUser($permissions));

  // Send the recipient a message and check the expected notice.
  $edit = [
    'subject[0][value]' => 'Test Message',
    'message[0][value]' => 'This is a test.',
  ];
  $this
    ->drupalPostForm('user/' . $recipient
    ->id() . '/contact', $edit, 'Send message');
  $this
    ->clickLink('here');
  $this
    ->assertResponse(200);
  $this
    ->assertTitle('Maillog Settings | Drupal');
}