diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-10-16 03:01:55 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-10-16 03:01:55 +0000 |
commit | 13d3072f418835569f37f65b5055e5b3180fad2e (patch) | |
tree | 6964b91e90d3bddbc3d5ce302897c35a248ddf6b /modules/simpletest | |
parent | b965f7478f34c78b747ad6667738828599e86df7 (diff) | |
download | brdo-13d3072f418835569f37f65b5055e5b3180fad2e.tar.gz brdo-13d3072f418835569f37f65b5055e5b3180fad2e.tar.bz2 |
- Patch #356074 by chx, Damien Tournoud: provide a sequences API.
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 2 | ||||
-rw-r--r-- | modules/simpletest/simpletest.test | 6 | ||||
-rw-r--r-- | modules/simpletest/tests/mail.test | 17 |
3 files changed, 20 insertions, 5 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 88850e472..e2cb53e0e 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1107,7 +1107,7 @@ class DrupalWebTestCase extends DrupalTestCase { $language = language_default(); // Use the test mail class instead of the default mail handler class. - variable_set('mail_sending_system', array('default-system' => 'TestingMailSystem')); + variable_set('mail_system', array('default-system' => 'TestingMailSystem')); // Use temporary files directory with the same prefix as the database. $public_files_directory = $this->originalFileDirectory . '/' . $db_prefix; diff --git a/modules/simpletest/simpletest.test b/modules/simpletest/simpletest.test index a26216a6e..3f157d4d1 100644 --- a/modules/simpletest/simpletest.test +++ b/modules/simpletest/simpletest.test @@ -339,7 +339,7 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase { $this->assertEqual(count($captured_emails), 0, t('The captured e-mails queue is empty.'), t('E-mail')); // Send the e-mail. - $response = drupal_mail_sending_system('simpletest', 'drupal_mail_test')->mail($message); + $response = drupal_mail_system('simpletest', 'drupal_mail_test')->mail($message); // Ensure that there is one e-mail in the captured e-mails array. $captured_emails = $this->drupalGetMails(); @@ -360,7 +360,7 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase { 'to' => $this->randomName(32) . '@example.com', 'body' => $this->randomString(512), ); - drupal_mail_sending_system('drupal_mail_test', $index)->mail($message); + drupal_mail_system('drupal_mail_test', $index)->mail($message); } // There should now be 6 e-mails captured. @@ -377,7 +377,7 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase { // Send the last e-mail again, so we can confirm that the drupalGetMails-filter // correctly returns all e-mails with a given property/value. - drupal_mail_sending_system('drupal_mail_test', $index)->mail($message); + drupal_mail_system('drupal_mail_test', $index)->mail($message); $captured_emails = $this->drupalGetMails(array('id' => 'drupal_mail_test_4')); $this->assertEqual(count($captured_emails), 2, t('All e-mails with the same id are returned when filtering by id.'), t('E-mail')); } diff --git a/modules/simpletest/tests/mail.test b/modules/simpletest/tests/mail.test index 641d606ff..5db3abb7e 100644 --- a/modules/simpletest/tests/mail.test +++ b/modules/simpletest/tests/mail.test @@ -25,7 +25,7 @@ class MailTestCase extends DrupalWebTestCase implements MailSystemInterface { parent::setUp(); // Set MailTestCase (i.e. this class) as the SMTP library - variable_set('mail_sending_system', array('default-system' => 'MailTestCase')); + variable_set('mail_system', array('default-system' => 'MailTestCase')); } /** @@ -42,6 +42,21 @@ class MailTestCase extends DrupalWebTestCase implements MailSystemInterface { } /** + * Concatenate and wrap the e-mail body for plain-text mails. + * + * @see DefaultMailSystem + */ + public function format(array $message) { + // Join the body array into one string. + $message['body'] = implode("\n\n", $message['body']); + // Convert any HTML to plain-text. + $message['body'] = drupal_html_to_text($message['body']); + // Wrap the mail body for sending. + $message['body'] = drupal_wrap_mail($message['body']); + return $message; + } + + /** * Send function that is called through the mail system. */ public function mail(array $message) { |