You are here

protected static function TestRequirementsTrait::getDrupalRoot in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/TestRequirementsTrait.php \Drupal\Tests\TestRequirementsTrait::getDrupalRoot()
  2. 9 core/tests/Drupal/Tests/TestRequirementsTrait.php \Drupal\Tests\TestRequirementsTrait::getDrupalRoot()

Returns the Drupal root directory.

Return value

string

3 calls to TestRequirementsTrait::getDrupalRoot()
DrupalKernelTest::setUp in core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
KernelTestBase::setUp in core/tests/Drupal/KernelTests/KernelTestBase.php
KernelTestBase::setUpBeforeClass in core/tests/Drupal/KernelTests/KernelTestBase.php

File

core/tests/Drupal/Tests/TestRequirementsTrait.php, line 23

Class

TestRequirementsTrait
Allows test classes to require Drupal modules as dependencies.

Namespace

Drupal\Tests

Code

protected static function getDrupalRoot() {
  return dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)), 2);
}