Merge pull request #839 from cerbero90/feature/compact-output

[2.x] Compact output when using datasets
This commit is contained in:
Nuno Maduro
2023-06-17 19:35:35 +01:00
committed by GitHub
2 changed files with 27 additions and 21 deletions

View File

@ -77,6 +77,12 @@ final class Exporter
*/ */
public function shortenedExport(mixed $value): string public function shortenedExport(mixed $value): string
{ {
return (string) preg_replace(['#\.{3}#', '#\\\n\s*#'], ['…'], $this->exporter->shortenedExport($value)); $map = [
'#\.{3}#' => '…',
'#\\\n\s*#' => '',
'# Object \(…\)#' => '',
];
return (string) preg_replace(array_keys($map), array_values($map), $this->exporter->shortenedExport($value));
} }
} }

View File

@ -80,7 +80,7 @@
✓ named datasets with dataset "one" ✓ named datasets with dataset "one"
✓ named datasets with dataset "two" ✓ named datasets with dataset "two"
✓ named datasets did the job right ✓ named datasets did the job right
✓ lazy named datasets with (Bar Object (…)) ✓ lazy named datasets with (Bar)
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #1 ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #1
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #2 ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #2
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), false) ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), false)
@ -134,24 +134,24 @@
✓ eager registered wrapped datasets with Generator functions did the job right ✓ eager registered wrapped datasets with Generator functions did the job right
✓ eager registered wrapped datasets with Generator functions display description with dataset "taylor" ✓ eager registered wrapped datasets with Generator functions display description with dataset "taylor"
✓ eager registered wrapped datasets with Generator functions display description with dataset "james" ✓ eager registered wrapped datasets with Generator functions display description with dataset "james"
✓ 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) #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 (Closure) #2
✓ it can resolve a dataset after the test case is available with multiple datasets with (Closure Object (…)) / (Closure Object (…)) #1 ✓ it can resolve a dataset after the test case is available with multiple datasets with (Closure) / (Closure) #1
✓ it can resolve a dataset after the test case is available with multiple datasets with (Closure Object (…)) / (Closure Object (…)) #2 ✓ it can resolve a dataset after the test case is available with multiple datasets with (Closure) / (Closure) #2
✓ it can resolve a dataset after the test case is available with multiple datasets with (Closure Object (…)) / (Closure Object (…)) #3 ✓ it can resolve a dataset after the test case is available with multiple datasets with (Closure) / (Closure) #3
✓ it can resolve a dataset after the test case is available with multiple datasets with (Closure Object (…)) / (Closure Object (…)) #4 ✓ it can resolve a dataset after the test case is available with multiple datasets with (Closure) / (Closure) #4
✓ 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) #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) #2
✓ it can resolve a dataset after the test case is available with shared array sets with (Closure Object (…)) #1 ✓ it can resolve a dataset after the test case is available with shared array sets with (Closure) #1
✓ it can resolve a dataset after the test case is available with shared array sets with (Closure Object (…)) #2 ✓ it can resolve a dataset after the test case is available with shared array sets with (Closure) #2
✓ it resolves a potential bound dataset logically with ('foo', Closure Object (…)) ✓ it resolves a potential bound dataset logically with ('foo', Closure)
✓ it resolves a potential bound dataset logically even when the closure comes first with (Closure Object (…), 'bar') ✓ it resolves a potential bound dataset logically even when the closure comes first with (Closure, 'bar')
✓ it will not resolve a closure if it is type hinted as a closure with (Closure Object (…)) #1 ✓ it will not resolve a closure if it is type hinted as a closure with (Closure) #1
✓ it will not resolve a closure if it is type hinted as a closure with (Closure Object (…)) #2 ✓ it will not resolve a closure if it is type hinted as a closure with (Closure) #2
✓ it will not resolve a closure if it is type hinted as a callable with (Closure Object (…)) #1 ✓ it will not resolve a closure if it is type hinted as a callable with (Closure) #1
✓ it will not resolve a closure if it is type hinted as a callable with (Closure Object (…)) #2 ✓ it will not resolve a closure if it is type hinted as a callable with (Closure) #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 with (Closure)
✓ it can correctly resolve a bound dataset that returns an array but wants to be spread with (Closure Object (…)) ✓ it can correctly resolve a bound dataset that returns an array but wants to be spread with (Closure)
↓ forbids to define tests in Datasets dirs and Datasets.php files ↓ forbids to define tests in Datasets dirs and Datasets.php files
PASS Tests\Features\Depends PASS Tests\Features\Depends
@ -586,7 +586,7 @@
✓ it passes with ('Fortaleza') ✓ it passes with ('Fortaleza')
✓ it passes with ('Sollefteå') ✓ it passes with ('Sollefteå')
✓ it passes with ('Ιεράπετρα') ✓ it passes with ('Ιεράπετρα')
✓ it passes with (stdClass Object (…)) ✓ it passes with (stdClass)
✓ it passes with array ✓ it passes with array
✓ it passes with *not* ✓ it passes with *not*
✓ it properly fails with *not* ✓ it properly fails with *not*