Skip to content

[HttpClient] More on testing, how to test request, example #15385

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

Merged
merged 1 commit into from
Sep 6, 2021

Conversation

SirRFI
Copy link
Contributor

@SirRFI SirRFI commented May 28, 2021

PR focused on HTTP Client's testing. Specifically:

  • Adds more to general description
  • Adds subsection about testing request data (such as which method was used, what headers/body, etc.) + example
  • Adds standalone PHPUnit-based example - demonstrates how to replace client for testing and how to do assertions

@carsonbot carsonbot added this to the 4.4 milestone May 28, 2021
@SirRFI SirRFI changed the title Http client request test [HttpClient] Add docs about request testing, example May 28, 2021
@SirRFI SirRFI changed the title [HttpClient] Add docs about request testing, example [HttpClient] More on testing, how to test request, example Jun 17, 2021
@AntonioCS
Copy link

Hey,
When is this getting merged? The example regarding sending raw json data via POST really helped me out,
This should be in the official docs page.

Copy link
Contributor

@pbowyer pbowyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition to the documentation! I'm proposing a few changes to make the description of why this is useful clearer; the rest is good.

Copy link

@andrewmy andrewmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super useful addition, had to figure this stuff out myself, hope it gets merged soon 🙏 A few nitpicks on English, hope they're correct 😅

@SirRFI SirRFI force-pushed the http_client_request_test branch 2 times, most recently from 7a0f16e to c37b9f2 Compare September 1, 2021 13:59
@SirRFI
Copy link
Contributor Author

SirRFI commented Sep 1, 2021

Thanks for suggestions - rebased the PR and applied them.

@javiereguiluz javiereguiluz force-pushed the http_client_request_test branch from c37b9f2 to 2c27ceb Compare September 6, 2021 15:47
@javiereguiluz javiereguiluz merged commit a149ca8 into symfony:4.4 Sep 6, 2021
@javiereguiluz
Copy link
Member

@SirRFI thanks a lot for this contribution. It's now merged.

For future contributions, please note that we prefer to not include full examples in Symfony Docs. We think those belong to blog posts and tutorials, whereas Symfony Docs should focus on showing each separate feature. Thanks!

@AntonioCS
Copy link

@javiereguiluz I'm sorry... but why? Why can't the docs have complete examples? Proper examples! More examples....
A lot of devs learn better and quicker with more extensive examples. From the simplest usage to the more complex, from the more common usage to the more unique. How does this not make sense?

English is not the fist language of many of the devs (myself included) so sometimes things get lost in translation, but I can read the code and have a better understanding of how to use whatever thing from symfony I'm using.

This merge is a perfect example, it was exactly what I was looking for, what I wanted to do but didn't know how and the docs didn't have any examples. It was @SirRFI that pointed me to the PR and saved the day.

Is this to force people to go to symfony casts and similar websites?

@javiereguiluz
Copy link
Member

The reason is that full-length examples are much more complex to maintain. We don't have the resources to do that and sadly, we'll never have them.

We can't keep with Symfony code pace (there are still many undocumented Symfony features) so just thinking about doing more things is wishful thinking.

I guess you'll be disappointed, but I think it's better to be honest and explain the true reasons.

@wouterj
Copy link
Member

wouterj commented Sep 8, 2021

Btw, feedback is always welcome. But you completely lost me when you started suggesting that a couple volunteers would make their work worse so that other services can be monetized.
I'm sorry, but I definitely hope that this isn't something you really think about the many volunteers and the handful paid contributors in the Symfony community...

@AntonioCS
Copy link

Why not just prefix the examples with the version? I understand that at the top you can select the version but something differs between minor versions just say: "This complex example is for version x.y.z".
I'll say it again, this more complex example, that was in PR for months, removed a lot of work from my task by providing something read to use for my issue.

But if you can't keep up with symfony code, maybe put more links to those tutorials you mentioned? That might mitigate some of the symfony code issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants