Skip to content

Commit f8880ad

Browse files
committed
Add the data set name to the output name of the test
1 parent 75180c9 commit f8880ad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/PrettyPrinter.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public function endTest(Test $test, float $time): void
4343

4444
$name = implode(' ', $testNameArray);
4545

46+
// get the data set name
47+
$name = $this->handleDataSetName($name, $testMethodName[1]);
48+
4649
$color = 'fg-green';
4750
if ($test->getStatus() !== 0) {
4851
$color = 'fg-red';
@@ -108,4 +111,15 @@ protected function formatExceptionMsg($exceptionMessage): string
108111

109112
return $exceptionMessage;
110113
}
114+
115+
private function handleDataSetName($name, $testMethodName): string
116+
{
117+
preg_match('/\bwith data set "([^"]+)"/', $testMethodName, $dataSetMatch);
118+
119+
if (empty($dataSetMatch)) {
120+
return $name;
121+
}
122+
123+
return $name . ' [' . $dataSetMatch[1] . ']';
124+
}
111125
}

0 commit comments

Comments
 (0)