-
-
Notifications
You must be signed in to change notification settings - Fork 7
Sequenced expectations can now be passed as non-callable values #16
Sequenced expectations can now be passed as non-callable values #16
Conversation
Can you apply the same work to |
Yes @nunomaduro 👍 |
@nunomaduro not 100% sure this is what you mean, but I've updated so that if you provide more than 1 argument to the expect([1, 2, 3])->each(fn($item) => $item->toBeInt()); // Works as normal
expect([1, 2, 3])->each(1, 2, 3); // Defers to sequence If I've misunderstood just let me know |
Also, whilst we're on this point, should expect([1, 2, 3])->each(fn($item) => $item->toBeInt()) instead return the normal expectation rather than the Each? Reason being that you're sort of indicating that you'd rather do the "each" expectation in a closure then carry on? expect([1, 2, 3])
->each(fn($item) => $item->toBeInt())
->toBeArray(); // This would currently fail, but I wouldn't expect it to |
@lukeraymonddowning Nevermind - What've said does not make sense. |
@nunomaduro reverted |
@@ -4,6 +4,9 @@ on: ['push', 'pull_request'] | |||
|
|||
jobs: | |||
cs: | |||
env: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note, this could be added to a top level env
key to remove the duplication, but not really necessary. 👍🏻
@lukeraymonddowning Can you please perform this pull request on the core? |
Previously, values passed to the
sequence
method had to be callable closures.This PR allows non-callable values to be passed to the
sequence
method. Each value will be wrapped in an expectation andtoEqual
will be called on it.Up for discussion is whether or not
toBe
would be better than toEqual here?This PR also fixes the CI pipeline, which previously would always fail when installing dependencies!