trait TestRequirementsTrait
Allows test classes to require Drupal modules as dependencies.
This trait is assumed to be on a subclass of \PHPUnit\Framework\TestCase, and overrides \PHPUnit\Framework\TestCase::checkRequirements(). This allows the test to be marked as skipped before any kernel boot processes have happened.
Hierarchy
- trait \Drupal\Tests\TestRequirementsTrait
1 file declares its use of TestRequirementsTrait
- KernelTestBase.php in core/tests/ Drupal/ KernelTests/ KernelTestBase.php 
File
- 
              core/tests/ Drupal/ Tests/ TestRequirementsTrait.php, line 14 
Namespace
Drupal\TestsView source
trait TestRequirementsTrait {
  
  /**
   * Returns the Drupal root directory.
   *
   * @return string
   *   The Drupal root directory.
   */
  protected static function getDrupalRoot() : string {
    return dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)), 2);
  }
}Members
| Title Sort descending | Modifiers | Object type | Summary | 
|---|---|---|---|
| TestRequirementsTrait::getDrupalRoot | protected static | function | Returns the Drupal root directory. | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
