function TestDiscovery::parseTestClassAnnotations
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Test/TestDiscovery.php \Drupal\Core\Test\TestDiscovery::parseTestClassAnnotations()
Parses annotations in the phpDoc of a test class.
Parameters
\ReflectionClass $class: The reflected test class.
Return value
array An associative array that contains all annotations on the test class; typically including:
- group: A list of @group values.
- requires: An associative array of @requires values; e.g.:
- module: A list of Drupal module dependencies that are required to exist.
See also
\PHPUnit\Util\Test::parseTestMethodAnnotations()
http://phpunit.de/manual/current/en/incomplete-and-skipped-tests.html#i…
File
-
core/
lib/ Drupal/ Core/ Test/ TestDiscovery.php, line 434
Class
- TestDiscovery
- Discovers available tests.
Namespace
Drupal\Core\TestCode
public static function parseTestClassAnnotations(\ReflectionClass $class) {
$annotations = Test::parseTestMethodAnnotations($class->getName())['class'];
// @todo Enhance PHPUnit upstream to allow for custom @requires identifiers.
// @see \PHPUnit\Util\Test::getRequirements()
// @todo Add support for 'PHP', 'OS', 'function', 'extension'.
// @see https://www.drupal.org/node/1273478
if (isset($annotations['requires'])) {
foreach ($annotations['requires'] as $i => $value) {
[
$type,
$value,
] = explode(' ', $value, 2);
if ($type === 'module') {
$annotations['requires']['module'][$value] = $value;
unset($annotations['requires'][$i]);
}
}
}
return $annotations;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.