mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
add tests for eager registered wrapped datasets with Generator functions
This commit is contained in:
@ -96,6 +96,11 @@
|
|||||||
✓ more than two datasets with (2) / (4) / (5)
|
✓ more than two datasets with (2) / (4) / (5)
|
||||||
✓ more than two datasets with (2) / (4) / (6)
|
✓ more than two datasets with (2) / (4) / (6)
|
||||||
✓ more than two datasets did the job right
|
✓ more than two datasets did the job right
|
||||||
|
✓ eager registered wrapped datasets with Generator functions with (1)
|
||||||
|
✓ eager registered wrapped datasets with Generator functions with (2)
|
||||||
|
✓ eager registered wrapped datasets with Generator functions with (3)
|
||||||
|
✓ eager registered wrapped datasets with Generator functions with (4)
|
||||||
|
✓ eager registered wrapped datasets with Generator functions did the job right
|
||||||
✓ it can resolve a dataset after the test case is available with (Closure Object (...))
|
✓ it can resolve a dataset after the test case is available with (Closure Object (...))
|
||||||
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1
|
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1
|
||||||
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #2
|
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #2
|
||||||
@ -722,5 +727,5 @@
|
|||||||
✓ it is a test
|
✓ it is a test
|
||||||
✓ it uses correct parent class
|
✓ it uses correct parent class
|
||||||
|
|
||||||
Tests: 4 incompleted, 9 skipped, 480 passed
|
Tests: 4 incompleted, 9 skipped, 485 passed
|
||||||
|
|
||||||
@ -13,3 +13,20 @@ dataset('numbers.closure.wrapped', function () {
|
|||||||
dataset('numbers.array', [[1], [2]]);
|
dataset('numbers.array', [[1], [2]]);
|
||||||
|
|
||||||
dataset('numbers.array.wrapped', [1, 2]);
|
dataset('numbers.array.wrapped', [1, 2]);
|
||||||
|
|
||||||
|
dataset('numbers.generators.wrapped', function () {
|
||||||
|
yield from firstSetOfNumber();
|
||||||
|
yield from secondSetOfNumbers();
|
||||||
|
});
|
||||||
|
|
||||||
|
function firstSetOfNumber(): Generator
|
||||||
|
{
|
||||||
|
yield 1;
|
||||||
|
yield 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
function secondSetOfNumbers(): Generator
|
||||||
|
{
|
||||||
|
yield 3;
|
||||||
|
yield 4;
|
||||||
|
}
|
||||||
|
|||||||
@ -228,10 +228,31 @@ test('more than two datasets did the job right', function () use ($state) {
|
|||||||
expect($state->text)->toBe('121212121212131423241314232411122122111221221112212213142324135136145146235236245246');
|
expect($state->text)->toBe('121212121212131423241314232411122122111221221112212213142324135136145146235236245246');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$wrapped_generator_state = new stdClass();
|
||||||
|
$wrapped_generator_state->text = '';
|
||||||
|
$wrapped_generator_function_datasets = [1, 2, 3, 4];
|
||||||
|
|
||||||
|
test(
|
||||||
|
'eager registered wrapped datasets with Generator functions',
|
||||||
|
function (int $text) use (
|
||||||
|
$wrapped_generator_state,
|
||||||
|
$wrapped_generator_function_datasets
|
||||||
|
) {
|
||||||
|
$wrapped_generator_state->text .= $text;
|
||||||
|
expect(in_array($text, $wrapped_generator_function_datasets))->toBe(true);
|
||||||
|
}
|
||||||
|
)->with('numbers.generators.wrapped');
|
||||||
|
|
||||||
|
test('eager registered wrapped datasets with Generator functions did the job right', function () use ($wrapped_generator_state) {
|
||||||
|
expect($wrapped_generator_state->text)->toBe('1234');
|
||||||
|
});
|
||||||
|
|
||||||
it('can resolve a dataset after the test case is available', function ($result) {
|
it('can resolve a dataset after the test case is available', function ($result) {
|
||||||
expect($result)->toBe('bar');
|
expect($result)->toBe('bar');
|
||||||
})->with([
|
})->with([
|
||||||
function () { return $this->foo; },
|
function () {
|
||||||
|
return $this->foo;
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
it('can resolve a dataset after the test case is available with shared yield sets', function ($result) {
|
it('can resolve a dataset after the test case is available with shared yield sets', function ($result) {
|
||||||
|
|||||||
Reference in New Issue
Block a user