Skip to content

Commit

Permalink
Show @testdox empty string parameters as '' when color is off
Browse files Browse the repository at this point in the history
  • Loading branch information
epdenouden committed Dec 14, 2018
1 parent 7a9745b commit 36c29e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Util/TestDox/NamePrettifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ private function mapTestMethodParameterNamesToProvidedDataValues(TestCase $test)
}

if (\is_string($value) && $value === '') {
$value = Color::colorize('underlined', 'empty');
if ($this->useColor) {
$value = Color::colorize('dim,underlined', 'empty');
} else {
$value = "''";
}
}

$providedData['$' . $parameter->getName()] = $value;
Expand Down
4 changes: 2 additions & 2 deletions tests/_files/raw_output_ColorTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Runtime: %s
✔ Colorize with one·color  %f ms
✔ Colorize with multiple·colors  %f ms
✔ Colorize path %ephp%eunit%etest.phpt after NULL  %f ms
✔ Colorize path %ephp%eunit%etest.phpt after empty  %f ms
✔ Colorize path %ephp%eunit%etest.phpt after empty  %f ms
✔ Colorize path %ephp%eunit%etest.phpt after %e  %f ms
✔ Colorize path %ephp%eunit%etest.phpt after %ephp%e  %f ms
✔ Colorize path %e_d-i.r%et-e_s.t.phpt after empty  %f ms
✔ Colorize path %e_d-i.r%et-e_s.t.phpt after empty  %f ms
✔ dim($m) and colorize('dim',$m) return different ANSI codes  %f ms
✔ Visualize all whitespace characters in no-spaces  %f ms
✔ Visualize all whitespace characters in ·space···invaders·  %s ms
Expand Down

0 comments on commit 36c29e8

Please sign in to comment.