Change record status: 
Project: 
Introduced in branch: 
8.1.x
Introduced in version: 
8.1.4
Description: 

NOTE: As of Drupal 11.x, use of test suite classes is deprecated. See: https://www.drupal.org/node/3405829

In Drupal 8.0, core's PHPUnit test suites were defined using paths, like this (from core/phpunit.xml.dist):

    <testsuite name="unit">
      <directory>./tests/Drupal/Tests</directory>
      <directory>./modules/*/tests/src/Unit</directory>
      <directory>../modules/*/tests/src/Unit</directory>
      <directory>../profiles/*/tests/src/Unit</directory>
      <directory>../sites/*/modules/*/tests/src/Unit</directory>
      <!-- Exclude Composer's vendor directory so we don't run tests there. -->
      <exclude>./vendor</exclude>
      <!-- Exclude Drush tests. -->
      <exclude>./drush/tests</exclude>
    </testsuite>

This proved to be unwieldy due to the fact that Drupal core allows contrib modules to be in many different configurations in the file system. Using paths to try and determine test suites for arbitrarily-placed contrib modules is pretty much impossible.

Thankfully, PHPUnit allows us to subclass \PHPUnit_Framework_TestSuite and implement suite() to perform our own discovery of test suites in a more dynamic way:

    <testsuite name="unit">
      <file>./tests/TestSuites/UnitTestSuite.php</file>
    </testsuite>

These test suite discovery classes use \Drupal\simpletest\TestDiscovery to scan for extensions, which brings the discovery process into harmony with core/scripts/run-tests.sh.

This change was introduced in the Drupal 8.1.4 release.

In the 8.1.4 release, through the 8.2.x releases, the test suite classes are located in core/tests/TestSuites/[suite name]Suite.php and are in the namespace of Drupal\Tests\TestSuites.

In the 8.3.x, this has been changed to core/tests/Drupal/TestSuites/[suite name]Suite.php, with the namespace of Drupal\TestSuites. This allows for easier testing of the suite classes.

Impacts: 
Module developers