ixis/codeception-drupal-mail

This package is abandoned and no longer maintained. No replacement package was suggested.

A Codeception module to provide Drupal mail system testing support.

0.2.2 2016-02-11 16:53 UTC

This package is not auto-updated.

Last update: 2020-08-21 20:17:09 UTC


README

#Drupal Mail System

Codeception module for testing the Drupal email system.

// Test to see expected number of emails sent.
$I->seeNumberOfEmailsSent(1);

// Clear emails from queue.
$I->clearSentEmails();

// Check email fields contains text
$I->seeSentEmail(array(
    "body" => "body contains this text",
    "subject" => "subject contains this text",
));

Relies on TestingMailSystem class which stores the emails in a drupal variable.

#Requirements

#Install

Install using composer:

"require": {
     "ixis/codeception-drupal-mail": "dev-develop"
   }

#Configure

Add 'DrupalMailSystem' and 'DrupalVariable' module to the suite configuration.

class_name: AcceptanceTester
modules:
    enabled:
        - DrupalMailSystem
        - DrupalVariable

DrupalVariable is required to read the variable that is used to temporarily store the email content.

To configure DrupalVariable see the ReadMe

##Module configuration

  • 'enabled' - set to true to set the TestingMailSystem as default mail system ('mail_system') at the beginning of the suite run and to restore it at the end. If you set this to false the module expects you to have set this yourself.
    • drush vset --format=json 'mail_system' '{"default-system":"TestingMailSystem"}'