You are here

public static function TestDiscovery::isUnitTest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/TestDiscovery.php \Drupal\simpletest\TestDiscovery::isUnitTest()

Determines if the provided classname is a unit test.

Parameters

$classname: The test classname.

Return value

bool TRUE if the class is a unit test. FALSE if not.

1 call to TestDiscovery::isUnitTest()
TestDiscovery::getTestInfo in core/modules/simpletest/src/TestDiscovery.php
Retrieves information about a test class for UI purposes.

File

core/modules/simpletest/src/TestDiscovery.php, line 425
Contains \Drupal\simpletest\TestDiscovery.

Class

TestDiscovery
Discovers available tests.

Namespace

Drupal\simpletest

Code

public static function isUnitTest($classname) {
  if (strpos($classname, 'Drupal\\Tests\\') === 0) {
    $namespace = explode('\\', $classname);
    $first_letter = Unicode::substr($namespace[2], 0, 1);
    if (Unicode::strtoupper($first_letter) === $first_letter) {

      // A core unit test.
      return TRUE;
    }
    elseif ($namespace[3] == 'Unit') {

      // A module unit test.
      return TRUE;
    }
  }
  return FALSE;
}