This code comes from the Nexcess Managed Applications (MAPPS) Must-Use plugin and is used to let the test suite run on PHPUnit 8 and above.
We're able to do this because our test suite takes advantage of Symfony's PHPUnit Bridge component, so we're already able to run our suite across multiple versions of PHPUnit, as the library takes care of differences like return typehints and differences in PHPUnit class names.
The (abbreviated) bootstrap.php
file in this gist shows how we load the core test suite and, if we're running PHP 8.0 or above, will duplicate the stock includes/bootstrap.php
file from the test suite to includes/bootstrap-phpunit8.php
.
The duplicated bootstrap file is the same as the version that ships with core, minus the "Looks like you're using PHPUnit $version" error.