Yesterday, we've finally upgraded to PHPUnit 8 (T192167). However, PHPUnit 9 is scheduled for release on Feb 7th, which means that we can start thinking about it. IMHO, we shouldn't rush the upgrade (given that various repos are probably still incompatible with PHPUnit 8). However, I find it wise to start preparing now, instead of letting tech debt accumulate.
This is especially true because PHPUnit 9 will have several compat breaks (source). Most notably:
- MockBuilder::setMethods will be hard-deprecated (it's already soft-deprecated in PHPUnit 8) in favour of more specific methods. As you may expect, setMethods is widely used, and it won't be easy to replace it with phpcs (although it's worth trying);
- The TestListener interface will be removed in favour of hooks. We have two classes using it; one is easy to migrate (gerrit patch), the other one will be a little harder because it listens to Suite events;
- ResultPrinter will become an interface. We subclass the current ResultPrinter to augment logs (the "logs generated by test case" lines);
- The methods that were hard-deprecated in PHPUnit 8 (assertInternalType, assertAttribute*, assertArraySubset, ...) will be removed;
- It will not support PHP 7.2 -- which is (IMHO) the main reason to delay the upgrade itself. See T261872: Drop PHP 7.2 support from MediaWiki master branch, once Wikimedia production is on 7.3
In general, we should probably try to clean up our entry points, and reduce customization to the minimum (re subclassing ResultPrinter, having MediaWikiPHPUnitCommand, SuiteEventsTrait and other things that mess with suites)