PHP code example of fetch / zend-mail-codeception-module
1. Go to this page and download the library: Download fetch/zend-mail-codeception-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fetch / zend-mail-codeception-module example snippets
function mail_filename(){
return uniqid() . '.mail';
}
$transportOptions = new Zend\Mail\Transport\FileOptions([
'path' => 'tests/_output/mail',
'callback' => 'mail_filename'
]);
$transport = new Zend\Mail\Transport\File($transportOptions);
$I = new WebGuy($scenario);
$I->wantTo('Get a password reset email');
// Cleared old emails from path
$I->resetEmails();
// Reset
$I->amOnPage('forgotPassword.php');
$I->fillField("input[name='email']", '[email protected]');
$I->click("Submit");
$I->see("Please check your email");
$I->seeInLastEmail("Please click this link to reset your password");
// Clears all emails
$I->resetEmails();
$I->seeInLastEmail('Thanks for signing up!');
$I->seeInLastEmailTo('[email protected]', 'Thanks for signing up!');
$I->seeInLastEmailTo('[email protected]', 'A new user has signed up!');
$I->dontSeeInLastEmail('Hit me with those laser beams');
$I->dontSeeInLastEmailTo('[email protected]', 'But shoot it in the right direction');