--list-tests-xml
is broken when a group with a numeric name is defined #6096
Closed
Description
Q | A |
---|---|
PHPUnit version | 11.5.2 |
PHP version | 8.3 |
Installation Method | Composer |
Summary
If a @group
annotation specifies a numeric group (for example, 44), running PHPUnit 11 with the --list-tests-xml
leads to an internal error. Same if you specify a corresponding group attribute #[Group('44')]
. PHPUnit 10 is not affected.
PHPUnit 11.5.2 by Sebastian Bergmann and contributors.
An error occurred inside PHPUnit.
Message: XMLWriter::writeAttribute(): Argument #2 ($value) must be of type string, int given
Location: vendor/phpunit/phpunit/src/TextUI/Command/Commands/ListTestsAsXmlCommand.php:111
#0 vendor/phpunit/phpunit/src/TextUI/Command/Commands/ListTestsAsXmlCommand.php(111): XMLWriter->writeAttribute('name', 44)
#1 vendor/phpunit/phpunit/src/TextUI/Application.php(326): PHPUnit\TextUI\Command\ListTestsAsXmlCommand->execute()
#2 vendor/phpunit/phpunit/src/TextUI/Application.php(520): PHPUnit\TextUI\Application->execute(Object(PHPUnit\TextUI\Command\ListTestsAsXmlCommand), true)
#3 vendor/phpunit/phpunit/src/TextUI/Application.php(183): PHPUnit\TextUI\Application->executeCommandsThatRequireTheTestSuite(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\TextUI\CliArguments\Configuration), Object(PHPUnit\Framework\TestSuite))
#4 vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#5 vendor/bin/phpunit(122): include('/builds/issue/d...')
#6 {main}
Current behavior
See above
How to reproduce
See above
Expected behavior
No error and list printed or saved to file.