feat: reworks evalution of Test Case

This commit is contained in:
Nuno Maduro
2021-11-14 19:58:25 +00:00
parent cd34f0ba81
commit 4b213d63bd
26 changed files with 603 additions and 620 deletions

View File

@ -12,7 +12,8 @@ beforeEach(function () {
it('throws exception if dataset does not exist', function () {
$this->expectException(DatasetDoesNotExist::class);
$this->expectExceptionMessage("A dataset with the name `first` does not exist. You can create it using `dataset('first', ['a', 'b']);`.");
Datasets::get('first');
Datasets::resolve('foo', ['first']);
});
it('throws exception if dataset already exist', function () {
@ -27,13 +28,13 @@ it('sets closures', function () {
yield [1];
});
expect(iterator_to_array(Datasets::get('foo')()))->toBe([[1]]);
expect(Datasets::resolve('foo', ['foo']))->toBe(['foo with (1)' => [1]]);
});
it('sets arrays', function () {
Datasets::set('bar', [[2]]);
expect(Datasets::get('bar'))->toBe([[2]]);
expect(Datasets::resolve('bar', ['bar']))->toBe(['bar with (2)' => [2]]);
});
it('gets bound to test case object', function () {
@ -52,6 +53,7 @@ $datasets = [[1], [2]];
test('lazy datasets', function ($text) use ($state, $datasets) {
$state->text .= $text;
expect(in_array([$text], $datasets))->toBe(true);
})->with($datasets);