You are here

public function ContactEmailsReplyToTest::testReplyToDefault in Contact Emails 8

Test default functionality to email address.

Throws

\Exception

File

src/Tests/ContactEmailsReplyToTest.php, line 32

Class

ContactEmailsReplyToTest
Tests contact emails reply to and recipients.

Namespace

Drupal\contact_emails\Tests

Code

public function testReplyToDefault() {
  $this
    ->setSiteMail();

  // Add the email.
  $params = [
    'subject[0][value]' => 'Contact Emails Test Form Subject',
    'message[0][value]' => 'Contact Emails Test Form Body',
    'recipient_type[0][value]' => 'default',
    'reply_to_type[0][value]' => 'default',
    'status[value]' => TRUE,
  ];
  $this
    ->drupalPostForm('/admin/structure/contact/manage/contact_emails_test_form/emails/add', $params, t('Save'));

  // Submit the contact form on the front-end of the website.
  $params = [
    'subject[0][value]' => 'Submission Test Form Subject',
    'message[0][value]' => 'Submission Test Form Body',
  ];
  $this
    ->drupalPostForm('/contact/contact_emails_test_form', $params, t('Send message'));

  // Assert that the reply-to is the default site email.
  $this
    ->assertText('Message-reply-to:site-default-mail@test.com', 'Message to set to default successfully.');
}