From ee59107c23a0c657d87550cca3fe601e5314992c Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Mon, 31 Aug 2009 18:30:27 +0000 Subject: #331180 by pwolanin and Rob Loach: Added pluggable smtp/mail framework. --- modules/simpletest/tests/mail.test | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 modules/simpletest/tests/mail.test (limited to 'modules/simpletest/tests/mail.test') diff --git a/modules/simpletest/tests/mail.test b/modules/simpletest/tests/mail.test new file mode 100644 index 000000000..641d606ff --- /dev/null +++ b/modules/simpletest/tests/mail.test @@ -0,0 +1,51 @@ + 'Mail system', + 'description' => 'Performs tests on the pluggable mailing framework.', + 'group' => 'System', + ); + } + + function setUp() { + parent::setUp(); + + // Set MailTestCase (i.e. this class) as the SMTP library + variable_set('mail_sending_system', array('default-system' => 'MailTestCase')); + } + + /** + * Assert that the pluggable mail system is functional. + */ + function testPluggableFramework() { + global $language; + + // Use MailTestCase for sending a message. + $message = drupal_mail('simpletest', 'mail_test', 'testing@drupal.org', $language); + + // Assert whether the message was sent through the send function. + $this->assertEqual(self::$sent_message['to'], 'testing@drupal.org', t('Pluggable mail system is extendable.')); + } + + /** + * Send function that is called through the mail system. + */ + public function mail(array $message) { + self::$sent_message = $message; + } +} + -- cgit v1.2.3