function TestRequirementsTrait::getDrupalRoot

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

Returns the Drupal root directory.

Return value

string

2 calls to TestRequirementsTrait::getDrupalRoot()
FileCopyTest::providerSuccessfulReuse in core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
Provides the source and destination path files.
OEmbedSourceTest::testThumbnailUri in core/modules/media/tests/src/Kernel/OEmbedSourceTest.php
Tests that remote thumbnails are downloaded correctly.

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);
}

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