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

Updates Mail::pretend to Mail::fake and adds template-based testing example #170

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Mrkbingham
Copy link

It appears this section of the docs is outdated. The Mail::pretend() method was a part of Laravel's Mail facade in versions prior to Laravel 5.5. This method was used to prevent emails from actually being sent during testing, and instead write them to the application's log files.

However, this method has been removed in Laravel 5.5 and later versions. The recommended way to prevent emails from being sent during testing is to use the Mail::fake() method, which is part of the Mail facade in Laravel 5.5 and later versions.

There is one example added here that is not very clear in the Laravel documentation since theirs only passes through classes, and checking for templates will be very relevant to WinterCMS developers.

@bennothommo
Copy link
Member

@Mrkbingham thanks for submitting this PR.

We still provide the pretend() method in our Mailer implementation for backwards compatibility, and it does serve a separate purpose to the fake Mail instances provided by the Mail::fake() facade method - dynamically recording mail in logs as opposed to allowing test assertions through the MailFake instance.

I would suggest that perhaps we display both in the docs and outline the scenarios in which you would use one or the other - ie. use pretend() for quick logging of mail during development, and use fake() for unit testing.

Any thoughts on this?

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

Successfully merging this pull request may close these issues.

None yet

2 participants