diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-31 18:30:27 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-31 18:30:27 +0000 |
commit | ee59107c23a0c657d87550cca3fe601e5314992c (patch) | |
tree | 34d739b06e166328784b4423ccb6599c2aab27b7 /modules/simpletest/tests | |
parent | 701d06521766ec81599a41f3d262047e12a9f820 (diff) | |
download | brdo-ee59107c23a0c657d87550cca3fe601e5314992c.tar.gz brdo-ee59107c23a0c657d87550cca3fe601e5314992c.tar.bz2 |
#331180 by pwolanin and Rob Loach: Added pluggable smtp/mail framework.
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r-- | modules/simpletest/tests/mail.test | 51 |
1 files changed, 51 insertions, 0 deletions
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 @@ +<?php +// $Id$ + +/** + * Test the Drupal mailing system. + */ +class MailTestCase extends DrupalWebTestCase implements MailSystemInterface { + /** + * The most recent message that was sent through the test case. + * + * We take advantage here of the fact that static variables are shared among + * all instance of the same class. + */ + private static $sent_message; + + function getInfo() { + return array( + 'name' => '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; + } +} + |