1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- /**
- * @file
- * Tests for devel module.
- */
- /**
- * Test devel mail functionality.
- */
- class DevelMailTest extends DrupalWebTestCase {
- protected $profile = 'testing';
- /**
- * {@inheritdoc}
- */
- public static function getInfo() {
- return array(
- 'name' => 'Devel Mail interface',
- 'description' => 'Test sending mails with debug interface',
- 'group' => 'Devel',
- );
- }
- /**
- * {@inheritdoc}
- */
- function setUp() {
- parent::setUp();
- }
- /**
- * Test mail logging functionality.
- */
- function testMail() {
- require_once ('devel.mail.inc');
- $message = array();
- $message['to'] = 'drupal@example.com';
- $message['subject'] = 'Test mail';
- $message['headers'] = array(
- 'From' => 'postmaster@example.com',
- 'X-stupid' => 'dumb',
- );
- $message['body'] = "I am the body of this message";
- $d = new DevelMailLog();
- $filename = $d->getFileName($message);
- $content = $d->composeMessage($message);
- $expected_filename = $d->getOutputDirectory() . '/drupal@example.com-Test_mail-' . date('y-m-d_his') . '.mail.txt';
- $this->assertEqual($filename, $expected_filename);
- $this->assertEqual($content, 'From: postmaster@example.com
- X-stupid: dumb
- To: drupal@example.com
- Subject: Test mail
- I am the body of this message');
- }
- }
|