cool tech graphics

SimpleTest 6.x gets e-mail capture!

One email was captured.
The latest 6.x-2.9 release of SimpleTest includes a backport of the e-mail capture feature from D7. This means you can finally unit test e-mail sending functionality! There is still one bug to be ironed out, but a patch is available.

Here's a simple demo of how it works:

class UserTestCase extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => t('User functionality'),
      'description' => t('Test user creation.'),
      'group' => t('User'),
   * Test receiving user welcome e-mail.
  function testUserWelcome() {
    $name = $this->randomName();
    $edit = array(
      'name' => $name,
      'mail' => "$",
    $this->drupalPost('user/register', $edit, t('Create new account'));
    $this->assertMail('to', $edit['mail']);
Date posted: November 3, 2009

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Metal Toad is an Advanced AWS Consulting Partner. Learn more about our AWS Managed Services

Have questions?