PHPUnit 4.8 does not officially support PHP 7.0 and 7.1, though it currently works with with the current set Drupal test suite. In order to avoid problems in the future, and in anticipation of dropping PHP 5 support, PHPUnit 6 is needed to run tests.
Drupal 8 implements a compatibility layer to make the transition from PHPUnit 4 to 6. Developers should not have to change any tests that extend from the Drupal test base classes. The PHP version on your production server should match the one in development environment to ensure tests are run against an accurate environment.
If PHPUnit 4 is run in a PHP 7.0+ environment, the following error message will be shown
PHPUnit testing framework version 6 or greater is required when running on PHP 7.0 or greater. Run the command 'composer run-script drupal-phpunit-upgrade' in order to fix this.
Running 'composer run-script drupal-phpunit-upgrade' will remove PHPUnit 4, install PHPUnit 6, and update your composer.lock file.
In addition, if you have a local phpunit.xml configuration file based off phpunit.xml.dist before #2932606: Use PHPUnit 6 for PHP 7.0 / 7.1 testing, you need to update
<listeners>
<listener class="\Drupal\Tests\Listeners\DeprecationListener">
</listener>
<!-- The Symfony deprecation listener has to come after the Drupal
deprecation listener -->
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
</listener>
<listener class="\Drupal\Tests\Listeners\DrupalStandardsListener">
</listener>
<listener class="\Drupal\Tests\Listeners\DrupalComponentTestListener">
</listener>
</listeners>
to
<listeners>
<listener class="\Drupal\Tests\Listeners\DrupalListener">
</listener>
<!-- The Symfony deprecation listener has to come after the Drupal listener -->
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
</listener>
</listeners>
Related change: In Drupal 8.5.x, PHPUnit 6 is used for PHP 7.2: https://www.drupal.org/node/2936045