Merge pull request #302 from def-studio/show-only-name-for-named-datasets

hides dataset values if they have a name
This commit is contained in:
Nuno Maduro
2021-05-23 21:46:59 +01:00
committed by GitHub
2 changed files with 17 additions and 5 deletions

View File

@ -111,8 +111,10 @@ final class Datasets
{
$exporter = new Exporter();
$nameInsert = is_string($key) ? \sprintf('data set "%s" ', $key) : '';
if(is_int($key)){
return \sprintf(' with (%s)', $exporter->shortenedRecursiveExport($data));
}
return \sprintf(' with %s(%s)', $nameInsert, $exporter->shortenedRecursiveExport($data));
return \sprintf(' with data set "%s"', $key);
}
}

View File

@ -2,12 +2,22 @@
use Pest\Datasets;
it('show the names of named datasets in their description', function () {
it('show only the names of named datasets in their description', function () {
$descriptions = array_keys(Datasets::resolve('test description', [
'one' => [1],
'two' => [[2]],
]));
expect($descriptions[0])->toBe('test description with data set "one" (1)');
expect($descriptions[1])->toBe('test description with data set "two" (array(2))');
expect($descriptions[0])->toBe('test description with data set "one"');
expect($descriptions[1])->toBe('test description with data set "two"');
});
it('show the actual dataset of non-named datasets in their description', function () {
$descriptions = array_keys(Datasets::resolve('test description', [
[1],
[[2]],
]));
expect($descriptions[0])->toBe('test description with (1)');
expect($descriptions[1])->toBe('test description with (array(2))');
});