-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarDumper] Add function jd()
to dump variables without html tags in json api call
#54772
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
Why calling this function I think you may instead set a new VarDumper handler in your tests context. This will allow you to use the CliDumper rather than HtmlDumper. You will have less noise in your output. You can have an example here: https://symfony.com/doc/current/components/var_dumper.html#advanced-usage. You may do this in a Behat step executed before each scenario or feature. Alternatively, you can set the |
Indeed, I called jd() for JSON. It might be wiser to rename it vd() or vdd() for var_dump() and die(); Yes, I could add some setup to my Behat tests for this, but I found that other people had the same needs as me in the issue 49754. So I believe it could be useful to have such a function for "off-road" debugging :). |
There should be a "PlainTextDumper", and i would advocate that that would be the default, |
I think this is the correct way to think about it, maybe allow |
jd()
to dump variables without html tags in json api call
I think that'd make sense. Anyone up to give it a try? |
dd() is really useful in the browser. However, when testing my endpoints with Behat in command line, the HTML tags generated by dd() make the result unreadable. To address this issue, I introduced the function jd() to simply dump the variables without generating HTML tags. This approach is more convenient than replacing dd() with var_dump() + die() + status 500.
Please see the example below:
currently, when
dd(1,2,3)
;And with
jd(1,2,3)
;