function ExtensionListTestTrait::getModulePath

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

Gets the path for the specified module.

Parameters

string $module_name: The module name.

Return value

string The Drupal-root relative path to the module directory.

Throws

\Drupal\Core\Extension\Exception\UnknownExtensionException If the module does not exist.

3 calls to ExtensionListTestTrait::getModulePath()
DbLogTest::testBacktrace in core/modules/dblog/tests/src/Functional/DbLogTest.php
Tests that the details page displays correctly backtrace.
NoMultilingualReviewPageTest::setUp in core/modules/color/tests/src/Functional/Migrate/NoMultilingualReviewPageTest.php
ReviewPageTest::setUp in core/modules/tracker/tests/src/Functional/Migrate/ReviewPageTest.php

File

core/tests/Drupal/Tests/ExtensionListTestTrait.php, line 22

Class

ExtensionListTestTrait
Provides extension list methods.

Namespace

Drupal\Tests

Code

protected function getModulePath(string $module_name) : string {
  return \Drupal::service('extension.list.module')->getPath($module_name);
}

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