public function MandrillHooksTestCase::testMailAlterHook in Mandrill 7.2
Tests implementing hook_mandrill_mail_alter().
File
- tests/
mandrill_hooks.test, line 61 - Test class and methods for the Mandrill Test module.
Class
- MandrillHooksTestCase
- @file Test class and methods for the Mandrill Test module.
Code
public function testMailAlterHook() {
/**
* @see MandrillMailSystem::mail() for use example.
*/
$message = $this
->getMessageTestData();
$mandrill_params = array(
'message' => $message,
'function' => 'mandrill_sender_plain',
'args' => array(),
);
/**
* Perform alterations on the message.
* @see mandrill_test_mandrill_mail_alter()
*/
drupal_alter('mandrill_mail', $mandrill_params, $message);
// Test altered values.
$this
->assertEqual($mandrill_params['message']['subject'], 'Altered Test Subject', 'Tested altered mail subject.');
$this
->assertEqual($mandrill_params['message']['html'], '<p>Altered mail content</p>', 'Tested altered mail content.');
// Test unaltered values.
$this
->assertEqual($mandrill_params['message']['from_email'], $message['from_email'], 'Tested unaltered from email.');
$this
->assertEqual($mandrill_params['message']['from_name'], $message['from_name'], 'Tested unaltered from name.');
}