You are here

devel.test in Devel 7

Tests for devel module.

File

devel.test
View source
<?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');
  }

}

Classes

Namesort descending Description
DevelMailTest Test devel mail functionality.