-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Client] Can't access the profiler in functional tests #20282
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 think your profiler is getting disabled because you're not collecting. See https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L383-L385. I think removing the |
Actually that helped, but I'm still having some trouble with this issue. Because as far as I understood the manual says that Also I've tried to figure out where this error actually came from and found out that the Profiler was actually executed the whole time and that the results always appear in the |
Finally I've figured out the source of error (and of cause it was my own fault): In all the examples of sending emails in functional tests they always submit the email via a request and I'm doing this by submitting a form. And in this case I've just forgotten to set Therefore I'm closing this issue because it's not a bug - but a feature I misunderstood. |
@nplhse thanks to your comment I could fix a test that suffered the same problems. I've proposed to add some help in the Symfony Docs to prevent this error from happening to other developers: symfony/symfony-docs#7115 Thanks! |
…ls (javiereguiluz) This PR was squashed before being merged into the 2.7 branch (closes #7115). Discussion ---------- Better explain the most common problems when testing emails Testing emails is simple but in the past I've suffered lots of problems related to this. In fact, a few minutes ago I fixed a long standing wrong test thanks to this comment about page redirections and collectors: symfony/symfony#20282 (comment) I propose to create a new mini section to better explain the problems that you may face when testing emails. Commits ------- c2e0608 Better explain the most common problems when testing emails
I'm currently setting up some functional tests with symfony 3.1.5 and keep on running into an issue when trying to evaluate if an email has been submitted successfully.
I've enabled the profiler in my config_test.yml like this:
Within my test I request the Swiftmailer via the Profiler like this:
But I keep on getting the
Error: Call to a member function getCollector() on boolean
error. I think that I've located the problem and found out that$this->client->getProfile()
always returns false.As far as I know this comes from line 85 in the Symfony Profiler where the value of the
X-Debug-Token
is alwaysnull
.I'm really not sure if this is an actual bug, or just my stupidity but during my research on this topic i found this Post on a very similar issue on stackoverflow. But in my case I wasn't even able to find the X-Debug-token header within the request.
(Note: The actual code of this test can be found here in this repository.)
The text was updated successfully, but these errors were encountered: