Reimplements non-callable sequence values.

This commit is contained in:
luke
2021-06-16 20:34:17 +01:00
parent 729638a3bb
commit 241d4cf94c
3 changed files with 29 additions and 4 deletions

View File

@ -152,6 +152,8 @@
✓ loops back to the start if it runs out of sequence items
✓ it works if the number of items in the iterable is smaller than the number of expectations
✓ it works with associative arrays
✓ it can be passed non-callable values
✓ it can be passed a mixture of value types
PASS Tests\Features\Expect\toBe
✓ strict comparisons
@ -554,5 +556,5 @@
✓ it is a test
✓ it uses correct parent class
Tests: 4 incompleted, 7 skipped, 340 passed
Tests: 4 incompleted, 7 skipped, 342 passed

View File

@ -44,3 +44,19 @@ test('it works with associative arrays', function () {
function ($expectation, $key) { $expectation->toEqual('boom'); $key->toEqual('baz'); },
);
});
test('it can be passed non-callable values', function () {
expect(['foo', 'bar', 'baz'])->sequence('foo', 'bar', 'baz');
expect(static::getCount())->toBe(3);
});
test('it can be passed a mixture of value types', function () {
expect(['foo', 'bar', 'baz'])->sequence(
'foo',
function ($expectation) { $expectation->toEqual('bar')->toBeString(); },
'baz'
);
expect(static::getCount())->toBe(4);
});