This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Not working with Laravel 5.5.14? #81
Comments
@ejunker I can confirm this issue. On a existing upgraded Laravel 5.5. project. And thanks so much for the getMailer solution. You should probably submit a pull request :) |
Thanks @mattstauffer for adding the fix. I'm still curious as to why it broke in the first place. Strangely, the issue did not exist when using PHPUnit 5.* instead of 6.* and the root cause might actually be related to PHPUnit or maybe even Laravel. |
FatBoyXPC
added a commit
to FatBoyXPC/mailthief
that referenced
this issue
Nov 4, 2017
FatBoyXPC
added a commit
to FatBoyXPC/mailthief
that referenced
this issue
Nov 4, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
PHP 7.1.10
Laravel 5.5.14
PhpUnit 6.3.1
UPDATE: I do not see the issue if I downgrade to PHPUnit 5.7.22
I see in the commits that MailThief has been updated for Laravel 5.5, though when I have a fresh app with the following test, it fails.
I added debug output to
InteractsWithMail::hijackMail()
If you run the test above with the modified
hijackMail()
you will see that it is returning different instances and isn't a singleton like intended.I did a bit of debugging and it looks like a possible issue with
getMailer()
,$this->mailer
is never set so it always callsMailThief::getFacadeRoot()
which will create a new instance if one is not already resolved and return it, though it seems like the instance that is resolved inhijackMail()
is different that the instance you get when you call your assertions. This might be a Laravel bug but I thought I'd report it here first.I did find that if I modify
InteractsWithMail::getMailer
to be the following that it works fine because it memoizes the mailer and prevents future calls toMailThief::getFacadeRoot()
Is anybody else seeing this issue? It happens with a fresh Laravel app so I hope it isn't just an issue with my environment.
The text was updated successfully, but these errors were encountered: