function AssertPreconditionsTrait::getProjectRoot
Returns the absolute path of the project root.
Return value
string The absolute path of the project root.
See also
\Drupal\package_manager\PathLocator::getProjectRoot()
1 call to AssertPreconditionsTrait::getProjectRoot()
- AssertPreconditionsTrait::assertNoFailureMarker in core/
modules/ package_manager/ tests/ src/ Traits/ AssertPreconditionsTrait.php - Asserts that there is no failure marker present.
File
-
core/
modules/ package_manager/ tests/ src/ Traits/ AssertPreconditionsTrait.php, line 95
Class
- AssertPreconditionsTrait
- Asserts preconditions for tests to function properly.
Namespace
Drupal\Tests\package_manager\TraitsCode
private static function getProjectRoot() : string {
// This is tricky, because this method has to be static (since
// ::setUpBeforeClass is), so it can't just get the container from an
// instance member.
// Use reflection to extract the vendor directory from the class loader.
$class_loaders = ClassLoader::getRegisteredLoaders();
$vendor_directory = key($class_loaders);
return dirname($vendor_directory);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.