diff --git a/ChangeLog-11.3.md b/ChangeLog-11.3.md index 6101b7a580a..59682c7c826 100644 --- a/ChangeLog-11.3.md +++ b/ChangeLog-11.3.md @@ -10,6 +10,7 @@ All notable changes of the PHPUnit 11.3 release series are documented in this fi * [#4625](https://github.com/sebastianbergmann/phpunit/issues/4625): Generator yielding keys that are neither integer or string leads to hard-to-understand error message when used as data provider * [#4674](https://github.com/sebastianbergmann/phpunit/issues/4674): JSON assertions should treat objects as unordered * [#5929](https://github.com/sebastianbergmann/phpunit/issues/5929): TestDox output containing `$` at the beginning gets truncated when used with a data provider +* [#5943](https://github.com/sebastianbergmann/phpunit/issues/5943): Tests configured to be in group(s) using the XML configuration file are also added to the `default` group ## [11.3.3] - 2024-09-04 diff --git a/src/Metadata/Api/Groups.php b/src/Metadata/Api/Groups.php index 4b88eb2e8c0..71c3c7e5d18 100644 --- a/src/Metadata/Api/Groups.php +++ b/src/Metadata/Api/Groups.php @@ -59,10 +59,6 @@ public function groups(string $className, string $methodName, bool $includeVirtu $groups[] = $group->groupName(); } - if ($groups === []) { - $groups[] = 'default'; - } - if (!$includeVirtual) { return self::$groupCache[$key] = array_unique($groups); } diff --git a/tests/end-to-end/regression/5943.phpt b/tests/end-to-end/regression/5943.phpt new file mode 100644 index 00000000000..d1ed1bfb5d5 --- /dev/null +++ b/tests/end-to-end/regression/5943.phpt @@ -0,0 +1,20 @@ +--TEST-- +https://github.com/sebastianbergmann/phpunit/issues/5943 +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Available test group(s): + - bar + - barbara + - baz + - foo diff --git a/tests/end-to-end/regression/5943/phpunit.xml b/tests/end-to-end/regression/5943/phpunit.xml new file mode 100644 index 00000000000..bb66b5abc66 --- /dev/null +++ b/tests/end-to-end/regression/5943/phpunit.xml @@ -0,0 +1,11 @@ + + + + + tests/a + tests/b + + + diff --git a/tests/end-to-end/regression/5943/tests/a/OneTest.php b/tests/end-to-end/regression/5943/tests/a/OneTest.php new file mode 100644 index 00000000000..1b5ead72569 --- /dev/null +++ b/tests/end-to-end/regression/5943/tests/a/OneTest.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Issue5943; + +use PHPUnit\Framework\TestCase; + +final class OneTest extends TestCase +{ + public function testOne(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/regression/5943/tests/b/TwoTest.php b/tests/end-to-end/regression/5943/tests/b/TwoTest.php new file mode 100644 index 00000000000..6479eacece7 --- /dev/null +++ b/tests/end-to-end/regression/5943/tests/b/TwoTest.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Issue5943; + +use PHPUnit\Framework\TestCase; + +final class TwoTest extends TestCase +{ + public function testTwo(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/unit/Metadata/Api/GroupsTest.php b/tests/unit/Metadata/Api/GroupsTest.php index cee6175210e..08ff574e84c 100644 --- a/tests/unit/Metadata/Api/GroupsTest.php +++ b/tests/unit/Metadata/Api/GroupsTest.php @@ -30,7 +30,6 @@ public static function provider(): array return [ [ [ - 'default', ], NoGroupsMetadataTest::class, 'testOne',