A package to help with acceptance Email testing. The goal is to add usefull PHPunit assertions in a Trait that you can include when there is a need to test emails that are fired from acceptance testing packages like Laravel Dusk.
This package assumes that you've already installed Mailcatcher. You can check this tutorial on how to install it to your system.
$ composer require drakakisgeo/mailtester
After updating composer, add the ServiceProvider to the providers array in config/app.php
Drakakisgeo\Mailtester\MailtesterServiceProvider::class,
Copy the package config to your local config with the publish command:
$ php artisan vendor:publish --provider="Drakakisgeo\Mailtester\MailtesterServiceProvider"
Include the InteractsWithMailCatcher Trait in your test and make sure that your test extends the Laravel's Testcase class. Immediately you have access to the following methods:
- assertEmailIsSent()
- assertEmailFirstSubjectContains()
- assertEmailLastSubjectContains()
- assertEmailNthSubjectContains()
- assertEmailFirstSubjectEquals()
- assertEmailLastSubjectEquals()
- assertEmailNthSubjectEquals()
- assertEmailSubjectEquals()
- assertEmailFirstHtmlContains()
- assertEmailLastHtmlContains()
- assertEmailNthHtmlContains()
- assertEmailHtmlContains()
- assertEmailFirstTextContains()
- assertEmailLastTextContains()
- assertEmailNthTextContains()
- assertEmailTextContains()
- assertEmailFirstSenderEquals()
- assertEmailLastSenderEquals()
- assertEmailNthSenderEquals()
- assertEmailSenderEquals()
- assertEmailFirstRecipientsContain()
- assertEmailLastRecipientsContain()
- assertEmailNthRecipientsContain()
- assertEmailRecipientsContain()
- assertEmailFirstCcContain()
- assertEmailLastCcContain()
- assertEmailNthCcContain()
- assertEmailCcContain()
- assertEmailFirstBccContain()
- assertEmailLastBccContain()
- assertEmailNthtBccContain()
- assertEmailBccContain()
- Soon!
Please see CONTRIBUTING and CONDUCT for details.
The MIT License (MIT). Please see License File for more information.