function MailTestCase::testCancelMessage

Test that message sending may be canceled.

See also

simpletest_mail_alter()

File

modules/simpletest/tests/mail.test, line 49

Class

MailTestCase
@file Test the Drupal mailing system.

Code

function testCancelMessage() {
    global $language;
    // Reset the class variable holding a copy of the last sent message.
    self::$sent_message = NULL;
    // Send a test message that simpletest_mail_alter should cancel.
    $message = drupal_mail('simpletest', 'cancel_test', 'cancel@example.com', $language);
    // Assert that the message was not actually sent.
    $this->assertNull(self::$sent_message, 'Message was canceled.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.