-
Notifications
You must be signed in to change notification settings - Fork 11.5k
[12.x] Add toPrettyJson method #56697
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
[12.x] Add toPrettyJson method #56697
Conversation
If we were to do this (which I'm not entirely opposed to tbh) we may want to look at other spots we have |
I can work on it! Should I also update the Jsonable interface? I think this would be a breaking change tho if we update the interface. I can either not update the interface or target this to master for the 13.x version. Which approach do you want me to follow @taylorotwell? |
Many projects and packages implement that interface. There is a large impact on migrating all this code just to add a wrapper around another method with a fixed flag. I like the addition to the |
@rodrigopedra Yeah, I think it's not worth it. |
@taylorotwell I added the I see that some tests failed, but are not related with the changes, so IDK what to do in these cases. |
@WendellAdriel the failing test seems related to the changes:
Note that the error is listed before the risky test listing. From https://github.com/laravel/framework/actions/runs/17123763507/job/48570565794?pr=56697#logs Time: 01:25.939, Memory: 350.00 MB
There was 1 error:
1) Illuminate\Tests\Integration\Auth\ApiAuthenticationWithEloquentTest::testAuthenticationViaApiWithEloquentUsingWrongDatabaseCredentialsShouldNotCauseInfiniteLoop
Mockery\Exception\InvalidCountException: Method jsonSerialize(<Any Arguments>) from Mockery_193_Illuminate_Http_Resources_Json_JsonResource should be called
exactly 1 times but called 2 times.
/home/runner/work/framework/framework/vendor/mockery/mockery/library/Mockery/CountValidator/Exact.php:32
/home/runner/work/framework/framework/vendor/mockery/mockery/library/Mockery/Expectation.php:739
/home/runner/work/framework/framework/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php:202
/home/runner/work/framework/framework/vendor/mockery/mockery/library/Mockery/Container.php:583
/home/runner/work/framework/framework/vendor/mockery/mockery/library/Mockery/Container.php:519
/home/runner/work/framework/framework/vendor/mockery/mockery/library/Mockery.php:176
/home/runner/work/framework/framework/vendor/orchestra/testbench-core/src/Concerns/InteractsWithMockery.php:22
/home/runner/work/framework/framework/vendor/orchestra/testbench-core/src/Concerns/ApplicationTestingHooks.php:127
/home/runner/work/framework/framework/vendor/orchestra/testbench-core/src/Concerns/Testing.php:70
/home/runner/work/framework/framework/src/Illuminate/Collections/helpers.php:236
/home/runner/work/framework/framework/vendor/orchestra/sidekick/src/functions.php:87
/home/runner/work/framework/framework/src/Illuminate/Collections/helpers.php:236
/home/runner/work/framework/framework/vendor/orchestra/testbench-core/src/Concerns/Testing.php:98
/home/runner/work/framework/framework/vendor/orchestra/testbench-core/src/TestCase.php:61
--
There was 1 risky test:
1) Illuminate\Tests\Integration\Auth\ApiAuthenticationWithEloquentTest::testAuthenticationViaApiWithEloquentUsingWrongDatabaseCredentialsShouldNotCauseInfiniteLoop
* Test code or tested code did not remove its own error handlers
* Test code or tested code did not remove its own exception handlers
/home/runner/work/framework/framework/tests/Integration/Auth/ApiAuthenticationWithEloquentTest.php:38
ERRORS!
Tests: 11934, Assertions: 36005, Errors: 1, Warnings: 1, Skipped: 477, Risky: 1. |
@rodrigopedra thanks, but I don't see how this could be related TBH, since I didn't touch the |
@WendellAdriel you are right. I saw Mockery_193_Illuminate_Http_Resources_Json_JsonResource and thought it was related. Sorry =/ |
@rodrigopedra no worries, thanks for checking, because it could be something that I was not seeing! 💪 |
Looks like we have a test failing. |
@taylorotwell I thought the error was not related to these changes since I didn't touch the |
…avel-framework into feature/to-pretty-json
I found what was causing it! |
This is basically a syntax sugar for:
To be called like this: