Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--list-tests-xml is broken when a group with a numeric name is defined #6096

Closed
mondrake opened this issue Jan 9, 2025 · 1 comment
Closed
Labels
feature/test-runner CLI test runner status/waiting-for-feedback Waiting for feedback from original reporter type/bug Something is broken version/11 Something affects PHPUnit 11

Comments

@mondrake
Copy link
Contributor

mondrake commented Jan 9, 2025

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.

@mondrake mondrake added the type/bug Something is broken label Jan 9, 2025
@sebastianbergmann sebastianbergmann added feature/test-runner CLI test runner status/waiting-for-feedback Waiting for feedback from original reporter labels Jan 9, 2025
@sebastianbergmann
Copy link
Owner

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

@sebastianbergmann sebastianbergmann added the version/11 Something affects PHPUnit 11 label Jan 9, 2025
@sebastianbergmann sebastianbergmann changed the title --list-tests-xml is broken if a numeric @group annotation is specified --list-tests-xml is broken when a group with a numeric name is defined Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner status/waiting-for-feedback Waiting for feedback from original reporter type/bug Something is broken version/11 Something affects PHPUnit 11
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants