Download the PHP package fetch/zend-mail-codeception-module without Composer
On this page you can find all versions of the php package fetch/zend-mail-codeception-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fetch/zend-mail-codeception-module
More information about fetch/zend-mail-codeception-module
Files in fetch/zend-mail-codeception-module
Package zend-mail-codeception-module
Short Description Test emails in your Codeception acceptance tests
License
Informations about the package zend-mail-codeception-module
Zend Mail Codeception Module
This module will let you test emails that are sent during your Codeception acceptance tests.
Installation
Add the package into your composer.json:
{
"require-dev": {
"codeception/codeception": "*",
"fetch/zend-mail-codeception-module": "^1.0"
}
}
Tell Composer to download the package:
php composer.phar update
Update your Zend mail configuration to use a file transport:
Then enable it in your acceptance.suite.yml
configuration and set path
to the transport directory.
You will then need to rebuild your actor class:
php codecept.phar build
Example Usage
Actions
resetEmails
Clears the emails in the messages directory. This is prevents seeing emails sent during a previous test. You probably want to do this before you trigger any emails to be sent
Example:
seeInLastEmail
Checks that an email contains a value. It searches the full raw text of the email: headers, subject line, and body.
Example:
- Param $text
seeInLastEmailTo
Checks that the last email sent to an address contains a value. It searches the full raw text of the email: headers, subject line, and body.
This is useful if, for example a page triggers both an email to the new user, and to the administrator.
Example:
- Param $email
- Param $text
dontSeeInLastEmail
Checks that an email does NOT contain a value. It searches the full raw text of the email: headers, subject line, and body.
Example:
- Param $text
dontSeeInLastEmailTo
Checks that the last email sent to an address does NOT contain a value. It searches the full raw text of the email: headers, subject line, and body.
Example:
- Param $email
- Param $text
grabMatchesFromLastEmail
Extracts an array of matches and sub-matches from the last email based on
a regular expression. It searches the full raw text of the email: headers,
subject line, and body. The return value is an array like that returned by
preg_match()
.
Example:
- Param $regex
grabFromLastEmail
Extracts a string from the last email based on a regular expression. It searches the full raw text of the email: headers, subject line, and body.
Example:
- Param $regex
grabMatchesFromLastEmailTo
Extracts an array of matches and sub-matches from the last email to a given
address based on a regular expression. It searches the full raw text of the
email: headers, subject line, and body. The return value is an array like that
returned by preg_match()
.
Example:
- Param $email
- Param $regex
grabFromLastEmailTo
Extracts a string from the last email to a given address based on a regular expression. It searches the full raw text of the email: headers, subject line, and body.
Example:
- Param $email
- Param $regex
seeEmailCount
Asserts that a certain number of emails have been sent since the last time
resetEmails()
was called.
Example:
- Param $count
License
Released under the same license as Codeception: MIT