PHPUnit backported namespaced class names from PHPUnit 6 back to the older versions 4 and 5. We can start using these right now. This will make the later migration to PHPUnit 6 quite a lot easier, as the necessary patches will be much smaller.
In contrast to what the changelog states, PHPUnit 4.8.35 introduced these aliases:
* `PHPUnit_Framework_Assert` → `Assert`
* `PHPUnit_Framework_BaseTestListener` → `BaseTestListener`
* `PHPUnit_Framework_TestCase` → `TestCase`
* `PHPUnit_Framework_TestListener` → `TestListener`
In addition, PHPUnit 4.8.36 introduced these aliases:
* `PHPUnit_Framework_AssertionFailedError` → `AssertionFailedError`
* `PHPUnit_Framework_Test` → `Test`
* `PHPUnit_Framework_TestSuite` → `TestSuite`
The suggestion is to **not** care about any of these, but exclusively focus on replacing `PHPUnit_Framework_TestCase` with `TestCase`. This is the vast majority of replacements we need to do (about 84% when I count appearances in my local codebase, with the next one being 7% of `PHPUnit_Framework_MockObject_MockObject`). Focusing on this one class will make reviewing patches easier. All the other updates can be done later when actually updating to PHPUnit 6.
The suggestion is to **not** replace `… extends \PHPUnit_Framework_TestCase` with `… extends \PHPUnit\Framework\TestCase`, but with `… extends TestCase` and an import in the `use` section above. This fits better to the code style the Wikidata team is used to, where full qualified class names are avoided.
If a code base requires it's own PHPUnit version (this is the case for all PHP components that are not MediaWiki extensions), the suggestion is to go for this dependency in composer.json:
List of components that need an update: