Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient] Add JsonMockResponse::fromFile() and MockResponse::fromFile() shortcuts #52970

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
Dec 17, 2023

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Dec 9, 2023

Q A
Branch? 7.1
Bug fix? no
New feature? yes
Deprecations? no
Issues -
License MIT

I have noticed I use a lot of file fixtures for tests since they are more readable as stand-alone files.

I think adding small shortcut methods would help the DX.

@carsonbot carsonbot added this to the 7.1 milestone Dec 9, 2023
@fancyweb fancyweb force-pushed the http-client/mock-from-file branch 3 times, most recently from e3e831f to 0d7dce6 Compare December 9, 2023 13:36
@OskarStark
Copy link
Contributor

I am not really sold on the new $json parameter 🤔 Could't we just check if the data is_string() and remove the additional parameter?

@fancyweb
Copy link
Contributor Author

fancyweb commented Dec 9, 2023

We can't do the is_string trick because we already allow passing a string.

@fancyweb fancyweb force-pushed the http-client/mock-from-file branch from 0d7dce6 to 0a9d383 Compare December 13, 2023 14:26
@fancyweb fancyweb force-pushed the http-client/mock-from-file branch from 0a9d383 to fde8cc9 Compare December 13, 2023 14:26
@fabpot
Copy link
Member

fabpot commented Dec 17, 2023

Thank you @fancyweb.

@fabpot fabpot merged commit e595c52 into symfony:7.1 Dec 17, 2023
@fancyweb fancyweb deleted the http-client/mock-from-file branch December 18, 2023 08:32
@fabpot fabpot mentioned this pull request May 2, 2024
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.

5 participants