devel.test

  1. nittany7 modules/contrib/devel/devel.test
  2. cis7 modules/contrib/devel/devel.test
  3. mooc7 modules/contrib/devel/devel.test

Tests for devel module.

Classes

Namesort descending Description
DevelMailTest Test devel mail functionality.

File

modules/contrib/devel/devel.test
View source
  1. <?php
  2. /**
  3. * @file
  4. * Tests for devel module.
  5. */
  6. /**
  7. * Test devel mail functionality.
  8. */
  9. class DevelMailTest extends DrupalWebTestCase {
  10. protected $profile = 'testing';
  11. public static function getInfo() {
  12. return array(
  13. 'name' => 'Devel Mail interface',
  14. 'description' => 'Test sending mails with debug interface',
  15. 'group' => 'Devel',
  16. );
  17. }
  18. function setUp() {
  19. parent::setUp();
  20. }
  21. /**
  22. * Test mail logging functionality.
  23. */
  24. function testMail() {
  25. require_once ('devel.mail.inc');
  26. $message = array();
  27. $message['to'] = 'drupal@example.com';
  28. $message['subject'] = 'Test mail';
  29. $message['headers'] = array(
  30. 'From' => 'postmaster@example.com',
  31. 'X-stupid' => 'dumb',
  32. );
  33. $message['body'] = "I am the body of this message";
  34. $d = new DevelMailLog();
  35. $filename = $d->getFileName($message);
  36. $content = $d->composeMessage($message);
  37. $expected_filename = $d->getOutputDirectory() . '/drupal@example.com-Test_mail-' . date('y-m-d_his') . '.mail.txt';
  38. $this->assertEqual($filename, $expected_filename);
  39. $this->assertEqual($content, 'From: postmaster@example.com
  40. X-stupid: dumb
  41. To: drupal@example.com
  42. Test mail
  43. I am the body of this message');
  44. }
  45. }