trait TestCompatibilityTrait

Same name in other branches
  1. 9 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\TestCompatibilityTrait
  2. 9 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit9\TestCompatibilityTrait
  3. 8.9.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit6/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit6\TestCompatibilityTrait
  4. 8.9.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit7/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit7\TestCompatibilityTrait
  5. 11.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit9\TestCompatibilityTrait
  6. 11.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit10/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit10\TestCompatibilityTrait

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

Hierarchy

File

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

Namespace

Drupal\TestTools\PhpUnitCompatibility\PhpUnit9
View source
trait TestCompatibilityTrait {
    
    /**
     * Get test name.
     */
    public function name() : string {
        return $this->getName();
    }
    
    /**
     * Gets @covers defined on the test class.
     *
     * @return string[]
     *   An array of classes listed with the @covers annotation.
     */
    public function getTestClassCovers() : array {
        $annotations = Test::parseTestMethodAnnotations(static::class, $this->name());
        return $annotations['class']['covers'] ?? [];
    }

}

Members

Title Sort descending Modifiers Object type Summary
TestCompatibilityTrait::getTestClassCovers public function Gets @covers defined on the test class.
TestCompatibilityTrait::name public function Get test name.

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