TestCompatibilityTrait.php
Same filename in this branch
Same filename in other branches
- 9 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/TestCompatibilityTrait.php
- 9 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php
- 8.9.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit6/TestCompatibilityTrait.php
- 8.9.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit7/TestCompatibilityTrait.php
- 10 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php
Namespace
Drupal\TestTools\PhpUnitCompatibility\PhpUnit9File
-
core/
tests/ Drupal/ TestTools/ PhpUnitCompatibility/ PhpUnit9/ TestCompatibilityTrait.php
View source
<?php
declare (strict_types=1);
namespace Drupal\TestTools\PhpUnitCompatibility\PhpUnit9;
use PHPUnit\Util\Test;
/**
* Drupal's forward compatibility layer with multiple versions of PHPUnit.
*/
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'] ?? [];
}
}
Traits
Title | Deprecated | Summary |
---|---|---|
TestCompatibilityTrait | Drupal's forward compatibility layer with multiple versions of PHPUnit. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.