Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The message variable missing error in testing Mails #136

Open
DenTray opened this issue Jul 25, 2024 · 1 comment
Open

The message variable missing error in testing Mails #136

DenTray opened this issue Jul 25, 2024 · 1 comment

Comments

@DenTray
Copy link
Collaborator

DenTray commented Jul 25, 2024

According to the Laravel doc https://laravel.com/docs/5.8/mail#inline-attachments Laravel automatically add the message variable inside the template.

But while testing it, phpunit will fail with the next error

image image

In fact it works fine for the real email send

image
@DenTray DenTray changed the title Testing mails send The message variable missing error in testing Mails Jul 25, 2024
@DenTray
Copy link
Collaborator Author

DenTray commented Jul 30, 2024

The main reason of this one is merging the message variable into the view data on the sending level instead of preparing mail object

https://github.com/laravel/framework/blob/c2eb31872aa092cdd4ae977886636b76b1064bd8/src/Illuminate/Mail/Mailer.php#L311

As a first step to resolve this one - we need to try to get the mail content from the log driver instead of mocking Mail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant