PHP code example of cyber-duck / mailgrasp
1. Go to this page and download the library: Download cyber-duck/mailgrasp 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/ */
cyber-duck / mailgrasp example snippets
use \Cyberduck\MailGrasp\Testing\InteractsWithEmails;
$this->visit('/route/which/sends/2/emails')
->seeEmails(2);
$this->visit('/route/which/enqueues/2/emails')
->seeEmailsInQueue(2);
$this->visit('/route/with/no/emails')
->dontSeeEmails();
// OR
$this->visit('/route/with/no/emails')
->notSeeEmails();
$this->visit('/route/with/no/emails')
->dontSeeEmailsInQueue();
// OR
$this->visit('/route/with/no/emails')
->notSeeEmailsInQueue();
$this->visit('/route/which/sends/emails')
->seeEmail(function($m) {
$m->from('[email protected] ');
$m->to('[email protected] ');
$m->subject('Subject');
});
// OR
$this->visit('/route/which/sends/emails')
->seeEmail($this->message()
->from('[email protected] ')
->to('[email protected] ')
->subject('Subject');
});
$this->visit('/route/which/sends/emails')
->dontSeeEmail(function($m) {
$m->from('[email protected] ');
$m->to('[email protected] ');
$m->subject('Subject');
});
// OR
$this->visit('/route/which/sends/emails')
->dontSeeEmail($this->message()
->from('[email protected] ')
->to('[email protected] ')
->subject('Subject');
});
$this->visit('/route/which/enqueues/emails')
->seeEmailInQueue(function($m) {
$m->from('[email protected] ');
$m->to('[email protected] ');
$m->subject('Subject');
});
// OR
$this->visit('/route/which/enqueues/emails')
->seeEmailInQueue($this->message()
->from('[email protected] ')
->to('[email protected] ')
->subject('Subject');
});
$this->visit('/route/which/sends/emails')
->seeInEmail(function($m) {
$m->from('[email protected] ');
$m->to('[email protected] ');
$m->subject('Subject');
}, 'Lorem ipsum dolor sit amet');
// OR
$this->visit('/route/which/sends/emails')
->seeInEmail($this->message()
->from('[email protected] ')
->to('[email protected] ')
->subject('Subject');
}, 'Lorem ipsum dolor sit amet);
$this->visit('/route/which/enqueues/emails')
->clickInEmail(function($m) {
$m->from('[email protected] ');
$m->to('[email protected] ');
$m->subject('Subject');
});
// OR
$this->visit('/route/which/enqueues/emails')
->clickInEmail($this->message()
->from('[email protected] ')
->to('[email protected] ')
->subject('Subject');
});
$this->visit('/route/which/enqueues/emails')
->clickInEmail(function($m) {
$m->from('[email protected] ');
$m->to('[email protected] ');
$m->subject('Subject');
}, 'a.activation-link');
// OR
$this->visit('/route/which/enqueues/emails')
->clickInEmail($this->message()
->from('[email protected] ')
->to('[email protected] ')
->subject('Subject');
}, 'a.activation-link');