public function ContactEmailsRecipientTest::testSendToManual in Contact Emails 8
Test manual functionality to email address.
Throws
\Exception
File
- src/
Tests/ ContactEmailsRecipientTest.php, line 119
Class
- ContactEmailsRecipientTest
- Tests contact emails recipients.
Namespace
Drupal\contact_emails\TestsCode
public function testSendToManual() {
// Add the email.
$params = [
'subject[0][value]' => 'Contact Emails Test Form Subject',
'message[0][value]' => 'Contact Emails Test Form Body',
'recipient_type[0][value]' => 'manual',
'recipients[0][value]' => 'manual-email-1@test.com, manual-email-2@test.com',
'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 message to is the email of the currently logged in user.
$this
->assertText('Message-to:manual-email-1@test.com, manual-email-2@test.com', 'Message to set successfully.');
}