function DrupalTestCaseTrait::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
1 method overrides DrupalTestCaseTrait::getDrupalRoot()
- BuildTestBase::getDrupalRoot in core/
tests/ Drupal/ BuildTests/ Framework/ BuildTestBase.php - Get the root path of this Drupal codebase.
File
-
core/
tests/ Drupal/ Tests/ DrupalTestCaseTrait.php, line 54
Class
- DrupalTestCaseTrait
- Provides methods common across all Drupal abstract base test classes.
Namespace
Drupal\TestsCode
protected static 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.