* Xml::loadFile was moved to a new class in PHPUnit 9.5, cf.,
c331d28ac3
* PHPUnit XML coverage element were renamed in
7a494d1fa4
Bug: T320452
Change-Id: Iea9783005522f2851e86a4b56aa0771ed31442bb
Our current recommendation for adjusting PHPUnit configuration for
extension code coverage reports is to manually modify
tests/phpunit/suite.xml. This is cumbersome and annoying, since
suite.xml is version controlled.
This patch proposes a composer script to simplify editing
the (non-version controlled) phpunit.xml config in the root of the
MediaWiki repo. It is useful if you are interested in generating
code coverage reports based on unit tests only, not integration tests.
Usage: composer phpunit:coverage-edit -- extensions/GrowthExperiments
When you're done, you can run `rm phpunit.xml` to switch back to the
default phpunit.xml.dist.
The script will use the default includes/src/maintenance directories,
but a future improvement would be to identify the relevant directories
via the AutoloadClasses property of extension.json.
Another improvement would be to provide an option for passing
arbitrary paths in core, in case you are working on tests for a
specific class and want to generate coverage reports instantly.
We could probably also remove
dockerfiles/quibble-coverage/phpunit-suite-edit.py (which inspired
this patch) and use composer phpunit:coverage-edit instead.
Bug: T100294
Change-Id: Ia0ef41f67ca4a64b0d1ca0ddcee488c29630af0b