Merge branch 'master' into datasets-scope

# Conflicts:
#	tests/.snapshots/success.txt
This commit is contained in:
Fabio Ivona
2022-11-30 14:06:05 +01:00
17 changed files with 115 additions and 85 deletions

View File

@ -60,6 +60,9 @@
--columns <n> .................... Number of columns to use for progress output
--columns max ............ Use maximum number of columns for progress output
--stderr ................................. Write to STDERR instead of STDOUT
--no-progress .................... Disable output of test execution progress
--no-results ................................ Disable output of test results
--no-output ............................................. Disable all output
--display-incomplete .................. Display details for incomplete tests
--display-skipped ........................ Display details for skipped tests
--display-deprecations . Display details for deprecations triggered by tests
@ -68,8 +71,7 @@
--display-warnings ......... Display details for warnings triggered by tests
--reverse-list .............................. Print defects in reverse order
--teamcity ............... Report test execution progress in TeamCity format
--testdox ................. Report test execution progress in TestDox format
--no-interaction ........................ Disable TestDox progress animation
--testdox ............................ Report test results in TestDox format
LOGGING OPTIONS:
--log-junit <file> ................ Log test execution in JUnit XML format to file

View File

@ -29,7 +29,7 @@
✓ it does not append CoversNothing to other methods
✓ it throws exception if no class nor method has been found
PASS Tests\Features\DatasetsTests
PASS Tests\Features\Datasets
✓ it throws exception if dataset does not exist
✓ it throws exception if dataset already exist
✓ it sets closures
@ -102,6 +102,11 @@
✓ more than two datasets with (2) / (4) / (5)
✓ more than two datasets with (2) / (4) / (6)
✓ 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 (...)) #1
✓ it can resolve a dataset after the test case is available with (Closure Object (...)) #2
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1
@ -116,7 +121,6 @@
✓ it will not resolve a closure if it is type hinted as a callable with (Closure Object (...)) #2
✓ it can correctly resolve a bound dataset that returns an array with (Closure Object (...))
✓ it can correctly resolve a bound dataset that returns an array but wants to be spread with (Closure Object (...))
↓ forbids to define tests in Datasets dirs and Datasets.php files
PASS Tests\Features\Depends
✓ first
@ -664,47 +668,6 @@
✓ get 'foo' → get 'bar' → expect true → toBeTrue
✓ get 'foo' → expect true → toBeTrue
PASS Tests\Features\ScopedDatasets\Directory\NestedDirectory1\TestFileInNestedDirectoryWithDatasetsFile
✓ uses dataset with (1)
✓ uses dataset with (2)
✓ uses dataset with (3)
✓ uses dataset with (4)
✓ uses dataset with (5)
✓ uses dataset with ('ScopedDatasets/NestedDirector...ts.php')
✓ the right dataset is taken
PASS Tests\Features\ScopedDatasets\Directory\NestedDirectory2\TestFileInNestedDirectory
✓ uses dataset with (1)
✓ uses dataset with (2)
✓ uses dataset with (3)
✓ uses dataset with (4)
✓ uses dataset with (5)
✓ uses dataset with ('ScopedDatasets/Datasets/Scoped.php')
✓ the right dataset is taken
PASS Tests\Features\ScopedDatasets\Directory\TestFileWithLocallyDefinedDataset
✓ uses dataset with (1)
✓ uses dataset with (2)
✓ uses dataset with (3)
✓ uses dataset with (4)
✓ uses dataset with (5)
✓ uses dataset with ('ScopedDatasets/ScopedDatasets.php')
✓ the right dataset is taken
PASS Tests\Features\ScopedDatasets\Directory\TestFileWithScopedDataset
✓ uses dataset with (1)
✓ uses dataset with (2)
✓ uses dataset with (3)
✓ uses dataset with (4)
✓ uses dataset with (5)
✓ uses dataset with ('ScopedDatasets/Datasets/Scoped.php')
✓ the right dataset is taken
PASS Tests\Features\ScopedDatasets\TestFileOutOfScope
✓ uses dataset with (1)
✓ uses dataset with (2)
✓ the right dataset is taken
WARN Tests\Features\Skip
✓ it do not skips
- it skips with truthy → 1
@ -803,7 +766,7 @@
PASS Tests\Unit\Console\Help
✓ it outputs the help information when --help is used
PASS Tests\Unit\DatasetsTests
PASS Tests\Unit\Datasets
✓ it show only the names of named datasets in their description
✓ it show the actual dataset of non-named datasets in their description
✓ it show only the names of multiple named datasets in their description
@ -829,26 +792,6 @@
✓ it can resolve builtin value types
✓ it cannot resolve a parameter without type
PASS Tests\Unit\Support\DatasetInfo
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Datase...rs.php', true)
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Datasets.php', false)
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Featur...rs.php', true)
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Featur...rs.php', false)
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Featur...ts.php', false)
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Datase...rs.php', false)
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Datasets.php', true)
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Featur...rs.php', false) #1
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Featur...rs.php', false) #2
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Featur...ts.php', true)
✓ it computes the dataset scope with ('/var/www/project/tests/Datase...rs.php', '/var/www/project/tests')
✓ it computes the dataset scope with ('/var/www/project/tests/Datasets.php', '/var/www/project/tests')
✓ it computes the dataset scope with ('/var/www/project/tests/Featur...rs.php', '/var/www/project/tests/Features')
✓ it computes the dataset scope with ('/var/www/project/tests/Featur...rs.php', '/var/www/project/tests/Featur...rs.php') #1
✓ it computes the dataset scope with ('/var/www/project/tests/Featur...ts.php', '/var/www/project/tests/Features')
✓ it computes the dataset scope with ('/var/www/project/tests/Featur...rs.php', '/var/www/project/tests/Featur...ollers')
✓ it computes the dataset scope with ('/var/www/project/tests/Featur...rs.php', '/var/www/project/tests/Featur...rs.php') #2
✓ it computes the dataset scope with ('/var/www/project/tests/Featur...ts.php', '/var/www/project/tests/Featur...ollers')
PASS Tests\Unit\Support\Reflection
✓ it gets file name from closure
✓ it gets property values
@ -880,4 +823,4 @@
PASS Tests\Visual\Version
✓ visual snapshot of help command output
Tests: 4 incomplete, 2 todos, 18 skipped, 611 passed (1521 assertions)
Tests: 4 incomplete, 1 todo, 18 skipped, 567 passed (1465 assertions)

View File

@ -13,3 +13,20 @@ dataset('numbers.closure.wrapped', function () {
dataset('numbers.array', [[1], [2]]);
dataset('numbers.array.wrapped', [1, 2]);
dataset('numbers.generators.wrapped', function () {
yield from firstSetOfNumbers();
yield from secondSetOfNumbers();
});
function firstSetOfNumbers(): Generator
{
yield 1;
yield 2;
}
function secondSetOfNumbers(): Generator
{
yield 3;
yield 4;
}

View File

@ -230,6 +230,25 @@ test('more than two datasets did the job right', function () use ($state) {
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) {
expect($result)->toBe('bar');
})->with([