Skip to content

Commit

Permalink
Closes #5943
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Sep 8, 2024
1 parent 07eac5c commit 2aceb44
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 5 deletions.
1 change: 1 addition & 0 deletions ChangeLog-11.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 0 additions & 4 deletions src/Metadata/Api/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
20 changes: 20 additions & 0 deletions tests/end-to-end/regression/5943.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
https://github.com/sebastianbergmann/phpunit/issues/5943
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__ . '/5943';
$_SERVER['argv'][] = '--list-groups';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Available test group(s):
- bar
- barbara
- baz
- foo
11 changes: 11 additions & 0 deletions tests/end-to-end/regression/5943/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd"
>
<testsuites>
<testsuite name="default">
<directory groups="foo,baz">tests/a</directory>
<directory groups="bar,barbara">tests/b</directory>
</testsuite>
</testsuites>
</phpunit>
20 changes: 20 additions & 0 deletions tests/end-to-end/regression/5943/tests/a/OneTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <[email protected]>
*
* 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);
}
}
20 changes: 20 additions & 0 deletions tests/end-to-end/regression/5943/tests/b/TwoTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <[email protected]>
*
* 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);
}
}
1 change: 0 additions & 1 deletion tests/unit/Metadata/Api/GroupsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public static function provider(): array
return [
[
[
'default',
],
NoGroupsMetadataTest::class,
'testOne',
Expand Down

0 comments on commit 2aceb44

Please sign in to comment.