Skip to content

[9.x] Add whereNot method to Fluent JSON testing matchers - #43383

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
mateusjatenee:assertable-json-wherenot
Jul 27, 2022
Merged

[9.x] Add whereNot method to Fluent JSON testing matchers#43383
taylorotwell merged 3 commits into
laravel:9.xfrom
mateusjatenee:assertable-json-wherenot

Conversation

@mateusjatenee

Copy link
Copy Markdown
Contributor

I have a use case where I want to test that a given item does not exist on a JSON collection.
I found it a bit difficult to do this with the existing API, but it is quite possible (and likely) that I just missed something.

Here's an example of my use case: https://twitter.com/mateusjatenee/status/1550574619995815936

The tests are a bit messy because I started out scoping then and then implementing (tried out a couple different things as well), but if the PR looks good I can make them a little better.

@mateusjatenee

Copy link
Copy Markdown
Contributor Author

Whoopsie. Will check tests when I get back home.

@morloderex

Copy link
Copy Markdown
Contributor

@mateusjatenee How is this different than the missing method with a potentially new callback parameter added to it?

@mateusjatenee

Copy link
Copy Markdown
Contributor Author

@morloderex if we could figure out a nice way to handle the callback I don't think it'd be much different. The goal is to just make sure that a certain item does not exist (by filtering) — right now missing just makes sure a property doesn't exist.

@taylorotwell
taylorotwell merged commit 603202f into laravel:9.x Jul 27, 2022
@mateusjatenee
mateusjatenee deleted the assertable-json-wherenot branch July 27, 2022 14:38
Ken-vdE pushed a commit to Ken-vdE/framework that referenced this pull request Aug 9, 2022
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