function DrupalTestCase::getDrupalRoot

Returns the Drupal root directory.

Return value

string The Drupal root directory.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Access $this->root directly.

See also

https://www.drupal.org/node/3574112

File

core/tests/Drupal/Tests/DrupalTestCase.php, line 51

Class

DrupalTestCase
Provides the root base class for all Drupal core tests.

Namespace

Drupal\Tests

Code

protected function getDrupalRoot() : string {
  @trigger_error(__METHOD__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Access $this->root directly. See https://www.drupal.org/node/3574112', E_USER_DEPRECATED);
  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.