function TestRequirementsTrait::getDrupalRoot

Same name in other branches
  1. 9 core/tests/Drupal/Tests/TestRequirementsTrait.php \Drupal\Tests\TestRequirementsTrait::getDrupalRoot()
  2. 8.9.x core/tests/Drupal/Tests/TestRequirementsTrait.php \Drupal\Tests\TestRequirementsTrait::getDrupalRoot()
  3. 10 core/tests/Drupal/Tests/TestRequirementsTrait.php \Drupal\Tests\TestRequirementsTrait::getDrupalRoot()

Returns the Drupal root directory.

Return value

string

12 calls to TestRequirementsTrait::getDrupalRoot()
BlockRebuildTest::setUpBeforeClass in core/modules/block/tests/src/Kernel/BlockRebuildTest.php
ConfigValidationTest::createRecipeWithInvalidDataInFile in core/tests/Drupal/KernelTests/Core/Recipe/ConfigValidationTest.php
Creates a recipe with invalid config data in a particular file.
ContentImportTest::setUp in core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php
DriverSpecificKernelTestBase::setUp in core/tests/Drupal/KernelTests/Core/Database/DriverSpecificKernelTestBase.php
FileCopyTest::providerSuccessfulReuse in core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
Provides the source and destination path files.

... See full list

File

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

Class

TestRequirementsTrait
Allows test classes to require Drupal modules as dependencies.

Namespace

Drupal\Tests

Code

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

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