Skip to content
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

Illuminate/Testing/TestResponse.php not returning decoded response #52563

Closed
dropweb opened this issue Aug 23, 2024 · 1 comment
Closed

Illuminate/Testing/TestResponse.php not returning decoded response #52563

dropweb opened this issue Aug 23, 2024 · 1 comment

Comments

@dropweb
Copy link
Contributor

dropweb commented Aug 23, 2024

Laravel Version

11.x

PHP Version

8.1

Database Driver & Version

No response

Description

decodeResponseJson() here: https://github.com/illuminate/testing/blob/600e3d55288fec5dd00ebe330ce3766952611556/TestResponse.php#L998

This method called decodeResponseJson and with the comment "Validate and return the decoded response JSON." Returns the $testJson (which is asserted as vaid JSON) and not the $decodedResponse, which would seem like the correct data to return.

Maybe the comment is wrong and the name spurious. Otherwise I think that this should return the decoded JSON as implied.

I notice that this behaviour changed since 10.x

Steps To Reproduce

Run a test that requests decodeResponseJson() on a json output.

The returned data is the output of AssertableJsonString() and not the decoded response $decodedResponse, as stated.

@driesvints
Copy link
Member

Seems like a copy paste mistake indeed from the method below it. Would welcome a PR to adjust the comment! Thanks

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

No branches or pull requests

2 participants