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

[5.5] Make assertJsonCount able to use nested keys #22740

Merged
merged 3 commits into from
Jan 11, 2018
Merged

[5.5] Make assertJsonCount able to use nested keys #22740

merged 3 commits into from
Jan 11, 2018

Conversation

crissi
Copy link
Contributor

@crissi crissi commented Jan 11, 2018

Enhanced testing helper with assertJsonCount to be able to use nested keys for checking count more than just one level deep.

Added some tests that illustrate it pretty well.

@taylorotwell taylorotwell merged commit f7f6f13 into laravel:5.5 Jan 11, 2018
@christophrumpel
Copy link
Contributor

christophrumpel commented Jan 26, 2018

Hey @crissi ,

I got a question regarding this test:

$response->assertJsonCount(2, 'baz.*.bar');

What is the exact purpose of it? In baz we have two items and each of them has a key bar with two items. So should it be about the first one or about both?

I also think it currently only checks the items count within baz. Because when I test it like this:

$response->assertJsonCount(2, 'baz.*.1234');

Then the test still works because data_get($this->json(), $key) still returns an array with two items, but the items are null.

Am I getting something wrong here?

@crissi
Copy link
Contributor Author

crissi commented Jan 26, 2018 via email

@crissi
Copy link
Contributor Author

crissi commented Jan 27, 2018

You are right it I not meant to be used with *. I wil fix the tests

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.

3 participants