FINAL suepr merge step : added all modules to this super repos
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
name = "Reroute Email Test"
|
||||
description = "Helper module for the reroute email tests."
|
||||
core = 7.x
|
||||
package = Testing
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-10-24
|
||||
version = "7.x-1.1+28-dev"
|
||||
core = "7.x"
|
||||
project = "reroute_email"
|
||||
datestamp = "1382643190"
|
||||
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Reroute Email Test module installation functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
function reroute_email_test_install() {
|
||||
// Ensure Reroute Email Test runs after Reroute Email.
|
||||
db_update('system')
|
||||
->fields(array('weight' => 100))
|
||||
->condition('type', 'module', '=')
|
||||
->condition('name', 'reroute_email_test', '=')
|
||||
->execute();
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides Mail hook implementations for testing the Reroute Email module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_mail().
|
||||
*
|
||||
* This function allows testing Reroute Email's handling of a string passed for
|
||||
* message's body instead of an Array as required by drupal_mail. It also
|
||||
* allows testing the robustness of the handling of Cc and Bcc header keys.
|
||||
* Body, Cc and Bcc values are initialized from test case through $params.
|
||||
*/
|
||||
function reroute_email_test_mail($key, &$message, $params) {
|
||||
if ($key != 'test_reroute_email') {
|
||||
return;
|
||||
}
|
||||
$message['subject'] = "Reroute Email Test: Message body is a string, Cc and Bcc header keys have a special case";
|
||||
|
||||
// Body is provided as a string.
|
||||
if (!empty($params['body'])) {
|
||||
$message['body'] = $params['body'];
|
||||
}
|
||||
// Provide Cc and Bcc headers with an unexpected case.
|
||||
if (!empty($params['headers']['test_cc_key']) && !empty($params['headers'][$params['headers']['test_cc_key']])) {
|
||||
$message['headers'][$params['headers']['test_cc_key']] = $params['headers'][$params['headers']['test_cc_key']];
|
||||
}
|
||||
if (!empty($params['headers']['test_bcc_key']) && !empty($params['headers'][$params['headers']['test_bcc_key']])) {
|
||||
$message['headers'][$params['headers']['test_bcc_key']] = $params['headers'][$params['headers']['test_bcc_key']];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_mail_alter().
|
||||
*
|
||||
* This helper function is necessary to catch message's body if it is a string
|
||||
* to make it an array to be compliant with drupal_mail and prevent a Warning:
|
||||
* implode(): Invalid arguments passed in DefaultMailSystem->format().
|
||||
*/
|
||||
function reroute_email_test_mail_alter(&$message) {
|
||||
// Only alter the email for the key test_reroute_email.
|
||||
if ($message['key'] != 'test_reroute_email') {
|
||||
return;
|
||||
}
|
||||
// Prevent Warning from drupal_mail because body is not an array.
|
||||
if (is_string($message['body'])) {
|
||||
// Record to be checked in test in the log entries.
|
||||
watchdog('reroute_email_test', 'A String was detected in the body: <pre>!body</pre>', array('!body' => $message['body']), WATCHDOG_NOTICE);
|
||||
// Convert body to an Array.
|
||||
$message['body'] = array($message['body']);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user