Skip to content

Tests configured to be in group(s) using the XML configuration file are also added to the default group #5943

@sebastianbergmann

Description

@sebastianbergmann
tests
├── a
│   └── OneTest.php
└── b
    └── TwoTest.php

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
>
    <testsuites>
        <testsuite name="default">
            <directory groups="foo,baz">tests/a</directory>
            <directory groups="bar,barbara">tests/b</directory>
        </testsuite>
    </testsuites>
</phpunit>

tests/a/OneTest.php

<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;

final class OneTest extends TestCase
{
    public function testOne(): void
    {
        $this->assertTrue(true);
    }
}

tests/b/TwoTest.php

<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;

final class TwoTest extends TestCase
{
    public function testTwo(): void
    {
        $this->assertTrue(true);
    }
}

Actual

❯ ./vendor/bin/phpunit --list-groups
PHPUnit 11.3.3 by Sebastian Bergmann and contributors.

Available test group(s):
 - bar
 - barbara
 - baz
 - default
 - foo

Expected

❯ ./vendor/bin/phpunit --list-groups
PHPUnit 11.3.3 by Sebastian Bergmann and contributors.

Available test group(s):
 - bar
 - barbara
 - baz
 - foo

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions