public function TestEmailFormTest::testEmailWithDisplayName in Reroute Email 2.x
Test for reroute_email display name supporting.
Check if recipient field support an email with additional display name: "Display Name <display.name@example.com>"
Throws
\Behat\Mink\Exception\ResponseTextException
File
- tests/
src/ Functional/ TestEmailFormTest.php, line 118
Class
- TestEmailFormTest
- Test Reroute Email's form for sending a test email.
Namespace
Drupal\Tests\reroute_email\FunctionalCode
public function testEmailWithDisplayName() : void {
// Configure reroute_email module and pre-define a set of email addresses.
$email_allowlisted_one = 'email1@allowlisted.com';
$email_allowlisted_two = 'email2@allowlisted.com';
$email_allowlisted_not = 'email@not-allowlisted.com';
$this
->configureRerouteEmail(TRUE, $this->rerouteDestination, "{$email_allowlisted_one}, {$email_allowlisted_two}");
// Submitting Test Email form (an email expected to be rerouted).
$post = [
'to' => "Some Display Name <{$email_allowlisted_not}>",
];
$this
->assertEmailReroutedFromTestForm($post);
// Submitting Test Email form (an email expected not to be rerouted).
$post = [
'to' => "Display Name1 <{$email_allowlisted_one}>, Display Name2 <{$email_allowlisted_two}>",
];
$this
->assertEmailNotReroutedFromTestForm($post);
}