diff --git a/ChangeLog-9.6.md b/ChangeLog-9.6.md
index c0d370b212a..f8f7db26f11 100644
--- a/ChangeLog-9.6.md
+++ b/ChangeLog-9.6.md
@@ -4,6 +4,10 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil
## [9.6.5] - 2023-MM-DD
+### Changed
+
+* Backported the HTML and CSS improvements made to the `--testdox-html` from PHPUnit 10
+
### Fixed
* [#5205](https://github.com/sebastianbergmann/phpunit/issues/5205): Wrong default value for optional parameter of `PHPUnit\Util\Test::parseTestMethodAnnotations()` causes `ReflectionException`
diff --git a/src/Util/TestDox/HtmlResultPrinter.php b/src/Util/TestDox/HtmlResultPrinter.php
index 013d1de81b2..2dc3d75fbb7 100644
--- a/src/Util/TestDox/HtmlResultPrinter.php
+++ b/src/Util/TestDox/HtmlResultPrinter.php
@@ -31,24 +31,46 @@ final class HtmlResultPrinter extends ResultPrinter
text-rendering: optimizeLegibility;
font-variant-ligatures: common-ligatures;
font-kerning: normal;
- margin-left: 2em;
- background-color: #ffffff;
- color: #000000;
+ margin-left: 2rem;
+ background-color: #fff;
+ color: #000;
}
body > ul > li {
font-family: Source Serif Pro, PT Sans, Trebuchet MS, Helvetica, Arial;
- font-size: 2em;
+ font-size: larger;
}
h2 {
font-family: Tahoma, Helvetica, Arial;
- font-size: 3em;
+ font-size: larger;
+ margin: 0;
+ padding: 0.5rem 0;
}
ul {
list-style: none;
- margin-bottom: 1em;
+ margin: 0;
+ padding: 0;
+ margin-bottom: 2rem;
+ padding-left: 1rem;
+ text-indent: -1rem;
+ }
+
+ .success:before {
+ color: #4e9a06;
+ content: '✓';
+ padding-right: 0.5rem;
+ }
+
+ .defect {
+ color: #a40000;
+ }
+
+ .defect:before {
+ color: #a40000;
+ content: '✗';
+ padding-right: 0.5rem;
}
@@ -60,7 +82,7 @@ final class HtmlResultPrinter extends ResultPrinter
*/
private const CLASS_HEADER = <<<'EOT'
-
%s
+ %s
EOT;
@@ -101,7 +123,6 @@ protected function startClass(string $name): void
$this->write(
sprintf(
self::CLASS_HEADER,
- $name,
$this->currentTestClassPrettified
)
);
@@ -114,9 +135,8 @@ protected function onTest(string $name, bool $success = true): void
{
$this->write(
sprintf(
- " - %s %s
\n",
- $success ? '#555753' : '#ef2929',
- $success ? '✓' : '❌',
+ " - %s
\n",
+ $success ? 'success' : 'defect',
$name
)
);
diff --git a/tests/end-to-end/logging/testdox-html.phpt b/tests/end-to-end/logging/testdox-html.phpt
index a6c7a77f880..470fcd1e594 100644
--- a/tests/end-to-end/logging/testdox-html.phpt
+++ b/tests/end-to-end/logging/testdox-html.phpt
@@ -23,34 +23,56 @@ PHPUnit %s by Sebastian Bergmann and contributors.
text-rendering: optimizeLegibility;
font-variant-ligatures: common-ligatures;
font-kerning: normal;
- margin-left: 2em;
- background-color: #ffffff;
- color: #000000;
+ margin-left: 2rem;
+ background-color: #fff;
+ color: #000;
}
body > ul > li {
font-family: Source Serif Pro, PT Sans, Trebuchet MS, Helvetica, Arial;
- font-size: 2em;
+ font-size: larger;
}
h2 {
font-family: Tahoma, Helvetica, Arial;
- font-size: 3em;
+ font-size: larger;
+ margin: 0;
+ padding: 0.5rem 0;
}
ul {
list-style: none;
- margin-bottom: 1em;
+ margin: 0;
+ padding: 0;
+ margin-bottom: 2rem;
+ padding-left: 1rem;
+ text-indent: -1rem;
+ }
+
+ .success:before {
+ color: #4e9a06;
+ content: '✓';
+ padding-right: 0.5rem;
+ }
+
+ .defect {
+ color: #a40000;
+ }
+
+ .defect:before {
+ color: #a40000;
+ content: '✗';
+ padding-right: 0.5rem;
}
- Bank Account (PHPUnit\TestFixture\BankAccount)
+ Bank Account (PHPUnit\TestFixture\BankAccount)
-... 3 / 3 (100%) - ✓ Balance is initially zero
- - ✓ Balance cannot become negative
- - ✓ Balance cannot become negative
+... 3 / 3 (100%) - Balance is initially zero
+ - Balance cannot become negative
+ - Balance cannot become negative