-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer][Profiler] 6.2-dev Email context is empty message collected form Profiler #47993
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
Comments
I've found the issue. It's this line here: This empties the message context. By this commit here by @fabpot So the message is the same in the logger, and therefore in 6.2 profiler, the message context is empty. Do we need to empty the context? The email is fine, but in my tests I'm collecting the email from the profiler and checking that the context was set properly by my bundle. So this causes a failing test. |
It looks to me as though this line could be removed as the checks to see whether the email has already been rendered do not check the context, but instead just look to see if the templates are now null. |
PR raised. Hopefully a nice easy fix and no tests failing when 6.2 is released. |
See #47075 (comment) for the explanation of why we need to empty the context. |
Thanks @fabpot - I commented in the PR so we can discuss there whether this is an issue and could be a problem not having this information collected for the profiler or I need to adjust how I run tests. |
Thanks! I've got exactly the same problem. I'm using it in my tests. Isn't this a breaking change? |
I'd have thought so too @stephanvierkant but seems clearing the context is a good way to ensure that a I've re-worked the PR so it should hopefully satisfy both use cases by clearing the context before sending to the bus instead of after rendering. Busy times for the team as the 6.2 RC1 has been tagged today but hopefully we can work to getting this bug fix in place before the official release. |
Closed as will not be "fixed". See PR for comments. |
This was my little solution to keep tests as they were and get the context if it's helpful for anyone. It's not an ideal approach but with limited time it gets the job done and restores the context into the email message object as we read the events again. For me, the main purposes of my tests were to check specific context variables had been set, there were quite a lot of checks and this was the quickest way to ensure the tests would still run as they were without rethinking too much how and where to test. My application is mainly functional tests right now. |
Symfony version(s) affected
6.2-dev
Description
I test in my project that the
context
of the email has got the correct variables being set. But in 6.2 the message collected by the profiler now has an empty context.How to reproduce
In my case
website_name
is being set.I create the email like so:
$context
is:I collect the email and context from the profiler in my test:
And in 6.2 beta, the context is an empty array.
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: