function TestRequirementsTrait::getDrupalRoot

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

Returns the Drupal root directory.

Return value

string

7 calls to TestRequirementsTrait::getDrupalRoot()
BlockRebuildTest::setUpBeforeClass in core/modules/block/tests/src/Kernel/BlockRebuildTest.php
DrupalKernelTest::setUp in core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
FileCopyTest::providerSuccessfulReuse in core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
Provides the source and destination path files.
KernelTestBase::setUp in core/tests/Drupal/KernelTests/KernelTestBase.php
KernelTestBase::setUpBeforeClass in core/tests/Drupal/KernelTests/KernelTestBase.php

... See full list

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(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
}

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