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

[8.x] Add AssertableJson::each() method #38684

Merged
merged 2 commits into from
Sep 6, 2021
Merged

[8.x] Add AssertableJson::each() method #38684

merged 2 commits into from
Sep 6, 2021

Conversation

Gummibeer
Copy link
Contributor

This PR adds an each() method, similar to first() on the \Illuminate\Testing\Fluent\AssertableJson class to assert on each element of the current JSON.
This is helpful if you want to ensure that every object in the data key has the same structure for example. Or that each element has a 0 <= price <= 10 to test filter logic.

I'm not sure if that method should be added as abstract to \Illuminate\Testing\Fluent\Concerns\Has like the first() right now. If so I would assume that this is a breaking change and should be targeted to Laravel 9!?

@GrahamCampbell GrahamCampbell changed the title Add AssertableJson::each() method [8.x] Add AssertableJson::each() method Sep 6, 2021
@taylorotwell taylorotwell merged commit 389cd2b into laravel:8.x Sep 6, 2021
@Gummibeer Gummibeer deleted the patch-2 branch September 6, 2021 15:41
victorvilella pushed a commit to cdsistemas/framework that referenced this pull request Oct 12, 2021
* add AssertableJson::each() method

* add tests for new method
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

Successfully merging this pull request may close these issues.

2 participants