public function RerouteEmailTestCase::configureRerouteEmail in Reroute Email 7
Helper function to configure Reroute Email Settings.
Parameters
string $destination: (optional) The email address to which emails should be rerouted. Defaults to $this->rerouteDestination if set to NULL.
string $whitelisted: (optional) The whitelisted email addresses.
bool $enable: (optional) Set to TRUE to enable email Rerouting, defaults to TRUE.
bool $enable_message: (optional) Set to TRUE to show rerouting description, defaults to TRUE.
bool $enable_dsm: (optional) Set to TRUE to display a Drupal status message after rerouting submitted email, defaults to TRUE.
string $mail_keys: (optional) A list of modules or mail keys should be rerouted, defaults to empty string (all outgoing emails are rerouted).
7 calls to RerouteEmailTestCase::configureRerouteEmail()
- RerouteEmailContactTestCase::testBasicNotification in ./
reroute_email.test - Basic tests of email rerouting for emails sent through the Contact forms.
- RerouteEmailDefaultAddressTestCase::testRerouteDefaultAddress in ./
reroute_email.test - Test reroute email address is set to site_mail, sendmail_from or empty.
- RerouteEmailDomainWhitelistedTestCase::testDomainWhitelistedEmail in ./
reroute_email.test - Basic tests for the domain whitelisted addresses.
- RerouteEmailMailKeysTest::testMailKeysFilter in ./
reroute_email.test - Test Reroute Email with mail keys filter.
- RerouteEmailMultipleRecipientsTest::testMultipleRecipients in ./
reroute_email.test - Test Reroute Email with multiple recipients.
File
- ./
reroute_email.test, line 86 - Test the Reroute Email module.
Class
- RerouteEmailTestCase
- Provides common functionality for the Reroute Email test classes.
Code
public function configureRerouteEmail($destination = NULL, $whitelisted = NULL, $enable = NULL, $enable_message = NULL, $enable_dsm = NULL, $mail_keys = NULL) {
$current_values = $install_values = array(
REROUTE_EMAIL_ENABLE => TRUE,
REROUTE_EMAIL_ADDRESS => '',
REROUTE_EMAIL_WHITELIST => '',
REROUTE_EMAIL_ENABLE_MESSAGE => TRUE,
REROUTE_EMAIL_ENABLE_DSM => TRUE,
REROUTE_EMAIL_MAIL_KEYS => '',
);
foreach ($install_values as $key => $value) {
$current_values[$key] = variable_get($key, $value);
}
// Configure to Reroute Email settings form.
$post = array(
REROUTE_EMAIL_ENABLE => NULL === $enable ? $current_values[REROUTE_EMAIL_ENABLE] : $enable,
REROUTE_EMAIL_ADDRESS => NULL === $destination ? $current_values[REROUTE_EMAIL_ADDRESS] : $destination,
REROUTE_EMAIL_WHITELIST => NULL === $whitelisted ? $current_values[REROUTE_EMAIL_WHITELIST] : $whitelisted,
REROUTE_EMAIL_ENABLE_MESSAGE => NULL === $enable_message ? $current_values[REROUTE_EMAIL_ENABLE_MESSAGE] : $enable_message,
REROUTE_EMAIL_ENABLE_DSM => NULL === $enable_dsm ? $current_values[REROUTE_EMAIL_ENABLE_DSM] : $enable_dsm,
REROUTE_EMAIL_MAIL_KEYS => NULL === $mail_keys ? $current_values[REROUTE_EMAIL_MAIL_KEYS] : $mail_keys,
);
// Submit Reroute Email Settings form and check if it was successful.
$this
->drupalPost('admin/config/development/reroute_email', $post, t('Save configuration'));
$this
->assertText(t('The configuration options have been saved.'));
}