https://github.com/bpedroza/laravel-mail-assertions
Make assertions on emails in Laravel 6-10
https://github.com/bpedroza/laravel-mail-assertions
assertions laravel laravel-10-package laravel-6-package laravel-7-package laravel-8-package laravel-9-package laravel-mail-assertions phpunit
Last synced: 8 days ago
JSON representation
Make assertions on emails in Laravel 6-10
- Host: GitHub
- URL: https://github.com/bpedroza/laravel-mail-assertions
- Owner: bpedroza
- License: mit
- Created: 2019-10-31T14:41:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-12-23T15:17:31.000Z (about 1 year ago)
- Last Synced: 2025-09-27T05:30:56.228Z (4 months ago)
- Topics: assertions, laravel, laravel-10-package, laravel-6-package, laravel-7-package, laravel-8-package, laravel-9-package, laravel-mail-assertions, phpunit
- Language: PHP
- Homepage:
- Size: 123 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README

# Laravel Mail Assertions
Make assertions on emails in Laravel 6 - 11
This is a simple package to allow you to make assertions on emails sent with laravel.
This package is inspired by tightenco/mailthief which I used pre laravel 6. Now that
package is no longer supported, so I made this one to allow me to migrate without too
much hassle.
## Installation
`composer require bpedroza/laravel-mail-assertions --dev`
## Usage
First you will need to include the `Bpedroza\LaravelMailAssertions\MakesMailAssertions` trait
in your test.
Next you can start making assertions on emails:
| Method | Description |
| ------ | ----------- |
| `assertEmailNotSent` | Assert no emails were sent |
| `assertEmailSent` | Assert an email was sent |
| `assertEmailSentFrom` | Assert an email was sent from a given email address |
| `assertEmailSentTo` | Assert an email was sent to a given address |
| `assertEmailSentWithSubject` | Assert an email was sent with a given subject |
| `assertLastEmailContains` | Assert the last email sent contains a given string |