#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
- Drupal 7
- The DrupalVariable codeception module.
#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"}'