This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
Adds an every
call that can be chained in expectations for traversable
#7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Often, I find myself wanting to assert that everything in an array or Laravel Collection passes a given test.
For example, I might want to make sure that everything in a Collection is an instance of a certain class, or that no item in an array is greater than a certain value.
This PR adds the
every
method, which allows the user to perform assertions on individual items in iterable values.Usage
Imagine we want to make sure that every item in an array is less than 100. This PR allows for this with the
every
method:It works with
not
andand
methods:If this is something that you see as valuable, let me know if there are any changes you'd like to see and I shall sort it 👍
Thanks for the insanely beautiful API that is the expectations plugin!