public function RerouteEmailMultipleRecipientsTest::testMultipleRecipients in Reroute Email 7
Test Reroute Email with multiple recipients.
File
- ./
reroute_email.test, line 651 - Test the Reroute Email module.
Class
- RerouteEmailMultipleRecipientsTest
- Test Reroute Email with multiple recipients.
Code
public function testMultipleRecipients() {
// Set multiple whitelisted domain and rerouting emails. Multiple commas and
// semicolons are added for validation tests.
$this
->configureRerouteEmail('user1@example.com, user2@example.com,;;,,user@example.com', $this->whitelistedDomain);
// Make sure configured emails were set properly.
$reroute_to = 'user1@example.com,user2@example.com,user@example.com';
$this
->assertEqual(variable_get(REROUTE_EMAIL_ADDRESS), $reroute_to, 'Reroute email address was set.');
$this
->assertEqual(variable_get(REROUTE_EMAIL_WHITELIST), $this->whitelistedDomain, 'Whitelisted value was set.');
// Submit a test email (should be rerouted).
$to = 'some@not-exist.domain, whitelisted@example.com';
$this
->drupalPost('admin/config/development/reroute_email/test', array(
'to' => $to,
), t('Send email'));
// Check if the email was rerouted properly.
$this
->assertEmailOriginallyTo($to);
$this
->assertMail('to', $reroute_to, format_string('Email was properly rerouted to the email address: @destination.', array(
'@destination' => $reroute_to,
)));
// Submit a test email (should not be rerouted).
$to = 'whitelisted@example.com, user2@example.com, allowed@example.com';
$this
->drupalPost('admin/config/development/reroute_email/test', array(
'to' => $to,
), t('Send email'));
// Check if the email was not rerouted.
$this
->assertMail('to', $to, format_string('Email was properly sent the email addresses: @destination.', array(
'@destination' => $to,
)));
}