-
Notifications
You must be signed in to change notification settings - Fork 24
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
seeEmailIsSent()
not working when email is sent by a Symfony/Doctrine entity listener
#90
Comments
The Mail Logger for Symfony Mailer also has this problem. I tried to permanently persist the services as @picoss suggested for Swift Mailer, however it didn't work. So unfortunately this issue will have to be open a little longer. |
I have the same issue when sending e-mail this way using Swiftmailer. What more, after update from Symfony 4.4 and older Codeception to Symfony 5.2 and latest Codeception, I get |
You should not be sending emails in the entity listeners. Nor in doctrine lifecycle. |
@Legion112 Thank you very much for the video. do you think it's ok @ThomasLandauer ? |
In short: I don't agree ;-) In long: Codeception is a testing framework, not a best-practice guide. So besides the fact that for any best-practice there will always be some (strange) situations where breaking them is a good idea. My main argument is: It's not upon us to judge! If somebody does want to send an email from a listener - well, why not - it's their app, not ours ;-) And besides not agreeing in general, I don't even agree with the video sequence itself: What's wrong with sending out an email on the "persist" event (i.e. when the record is created)? So the essence of the serialize/unserialize example is for me:
Which is a warning you can apply to anything in programming... ;-) Finally: Following this same argument, we'd also have to remove typeInPopup, cause using |
Am I right that this is still not working, and probably never will? |
When using an Entity Listener to send an email,
seeEmailIsSent()
doesn't notice it. When I do the same email command in the controller, it works.The actual email delivery works in both cases (as shown by mailcatcher).
Details
The text was updated successfully, but these errors were encountered: