From 526479b0c129bd7f21261d24337dbf766925bb79 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 23 Mar 2021 08:04:07 +0100 Subject: [PATCH] Closes #4630 --- ChangeLog-9.5.md | 7 +++++ src/Util/TestDox/XmlResultPrinter.php | 3 +- tests/end-to-end/regression/GitHub/4630.phpt | 30 +++++++++++++++++++ .../regression/GitHub/4630/Issue4630Test.php | 16 ++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 tests/end-to-end/regression/GitHub/4630.phpt create mode 100644 tests/end-to-end/regression/GitHub/4630/Issue4630Test.php diff --git a/ChangeLog-9.5.md b/ChangeLog-9.5.md index 65e0d7d8d2b..632406bce65 100644 --- a/ChangeLog-9.5.md +++ b/ChangeLog-9.5.md @@ -2,6 +2,12 @@ All notable changes of the PHPUnit 9.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. +## [9.5.4] - 2021-MM-DD + +### Fixed + +* [#4630](https://github.com/sebastianbergmann/phpunit/issues/4630): Empty test case class causes error in TestDox XML logger + ## [9.5.3] - 2021-03-17 ### Fixed @@ -35,6 +41,7 @@ All notable changes of the PHPUnit 9.5 release series are documented in this fil * [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly +[9.5.4]: https://github.com/sebastianbergmann/phpunit/compare/9.5.3...9.5 [9.5.3]: https://github.com/sebastianbergmann/phpunit/compare/9.5.2...9.5.3 [9.5.2]: https://github.com/sebastianbergmann/phpunit/compare/9.5.1...9.5.2 [9.5.1]: https://github.com/sebastianbergmann/phpunit/compare/9.5.0...9.5.1 diff --git a/src/Util/TestDox/XmlResultPrinter.php b/src/Util/TestDox/XmlResultPrinter.php index e0ac56b4097..551c7d431b8 100644 --- a/src/Util/TestDox/XmlResultPrinter.php +++ b/src/Util/TestDox/XmlResultPrinter.php @@ -22,6 +22,7 @@ use PHPUnit\Framework\TestListener; use PHPUnit\Framework\TestSuite; use PHPUnit\Framework\Warning; +use PHPUnit\Framework\WarningTestCase; use PHPUnit\Util\Printer; use PHPUnit\Util\Test as TestUtil; use ReflectionClass; @@ -154,7 +155,7 @@ public function startTest(Test $test): void */ public function endTest(Test $test, float $time): void { - if (!$test instanceof TestCase) { + if (!$test instanceof TestCase || $test instanceof WarningTestCase) { return; } diff --git a/tests/end-to-end/regression/GitHub/4630.phpt b/tests/end-to-end/regression/GitHub/4630.phpt new file mode 100644 index 00000000000..451573ccf1d --- /dev/null +++ b/tests/end-to-end/regression/GitHub/4630.phpt @@ -0,0 +1,30 @@ +--TEST-- +https://github.com/sebastianbergmann/phpunit/issues/4630 +--FILE-- + + + + +Time: %s, Memory: %s + +There was 1 warning: + +1) Warning +No tests found in class "PHPUnit\TestFixture\Issue4630Test". + +WARNINGS! +Tests: 1, Assertions: 0, Warnings: 1. diff --git a/tests/end-to-end/regression/GitHub/4630/Issue4630Test.php b/tests/end-to-end/regression/GitHub/4630/Issue4630Test.php new file mode 100644 index 00000000000..619f92fe48d --- /dev/null +++ b/tests/end-to-end/regression/GitHub/4630/Issue4630Test.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture; + +use PHPUnit\Framework\TestCase; + +final class Issue4630Test extends TestCase +{ +}