Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[BrowserKit] Add jsonRequest function to the browser-kit client#38596
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[BrowserKit] Add jsonRequest function to the browser-kit client#38596
Uh oh!
There was an error while loading.Please reload this page.
Conversation
e57df9b to4fdf2faCompare4fdf2fa toe2edfc1CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
cc1415f to696a3f8CompareNyholm commentedOct 16, 2020
Thank you I like the idea of this because I know there are a lot of parameters to set when you want to test some custom requests. I am not sure it is a good idea to hard code the content type to Just FYI. There is asmall package from@nebkam that I like. It has a |
yceruto left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM.
@Nyholm about to hard code the content type toapplication/json I think it's fine as default value. Anyway, you'll can change these server parameters through the$server argument if you want.
| $server =array_merge($this->server,$server); |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks. Don't miss adding a changelog entry in the component.
alexander-schranz commentedOct 20, 2020
@nicolas-grekas changelog is updated. fabbot is failing because of#38596 (comment) and#38596 (comment). Let me now if I need to change something. |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What about@Nyholm's comment?
(yes you can ignore fabbot here, the report is a false-positive)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
alexander-schranz commentedOct 20, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@Nyholm I think we should go here with |
4948af9 tob1123d2CompareUh oh!
There was an error while loading.Please reload this page.
b1123d2 to596b2c0Compare…chranz)This PR was merged into the 4.4 branch.Discussion----------Refractor AbstractBrowserTest to assertSame| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | no| Deprecations? | no| Tickets | Fix #...instead -->| License | MIT| Doc PR | symfony/symfony-docs#... <!-- required for new features -->As mentioned by@nicolas-grekas at#38596 (comment) the AbstractBrowserTest should be refractored to use `assertSame` instead of `assertEquals` to compare string.Commits-------3f320c8 Refractor AbstractBrowserTest to assertSame
| } | ||
| /** | ||
| * Converts the request parameters into a json string and used it as request content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
json string ->JSON string
and used it ->and uses it
52efab2 toc2fa2cbComparechalasr commentedNov 11, 2020
Thank you@alexander-schranz. |
beongohl997 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
A
beongohl997 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
src/Symfony/Component/BrowserKit/AbstractBrowser.php
Uh oh!
There was an error while loading.Please reload this page.
If you use the FOSRestBundle for your Api's you have maybe many tests using just:
To test your JSON api as in the real browser request FOSRestBundle converts the json body into the
$request->requestobject. I think something similar is done by ApiPlatform. If you have tests like above they will now fail as the integer is converted to string see also#38591.This PR add a new
jsonRequestwhich will look like the following and will so fix the above problem: