Description
Q | A |
---|---|
PHPUnit version | 10.5.38 |
PHP version | 8.3 |
Installation Method | Composer |
Summary
ListTestsAsXmlCommand
builds the file
attribute of each <testClass>
node by getting the file path of the first test case method found in a class, and using the file path returned by calling $test->valueObjectForEvents()->file()
.
This is not accurate as this returns the file path of the file where the method is defined, not the file path of the class. The method could be defined in a parent base class, or in a trait, and then the file returned would not be the one where the TestCase class is contained.
Current behavior
See above.
How to reproduce
Make an abstract base TestCase class with test case methods in it, a separate concrete class with no methods extending the abstract, and run phpunit with the --list-tests-xml
option. The file attribute of the concrete <testClass>
will point to the abstract class file and not to the concrete one.
Expected behavior
The file path should match the class, as the autoloader will map.
Activity