1.20.x mail.test | MailTestCase::testCancelMessage() |
Test that message sending may be canceled.
See also
File
- modules/
simpletest/ tests/ mail.test, line 41 - Test the Backdrop mailing system.
Class
- MailTestCase
- @file Test the Backdrop 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 = backdrop_mail('simpletest', 'cancel_test', 'cancel@example.com', $language);
// Assert that the message was not actually sent.
$this->assertNull(self::$sent_message, 'Message was canceled.');
}