function TestCompatibilityTrait::getTestClassCovers

Same name in other branches
  1. 11.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit9\TestCompatibilityTrait::getTestClassCovers()
  2. 11.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit10/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit10\TestCompatibilityTrait::getTestClassCovers()

Gets @covers defined on the test class.

Return value

string[] An array of classes listed with the @covers annotation.

File

core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php, line 27

Class

TestCompatibilityTrait
Drupal's forward compatibility layer with multiple versions of PHPUnit.

Namespace

Drupal\TestTools\PhpUnitCompatibility\PhpUnit9

Code

public function getTestClassCovers() : array {
    $annotations = Test::parseTestMethodAnnotations(static::class, $this->name());
    return $annotations['class']['covers'] ?? [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.