
| Current Path : /var/www/html/rocksensor1/web/core/tests/Drupal/Tests/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/tests/Drupal/Tests/ExtensionListTestTrait.php |
<?php
declare(strict_types=1);
namespace Drupal\Tests;
/**
* Provides extension list methods.
*/
trait ExtensionListTestTrait {
/**
* Gets the path for the specified module.
*
* @param string $module_name
* The module name.
*
* @return string
* The Drupal-root relative path to the module directory.
*
* @throws \Drupal\Core\Extension\Exception\UnknownExtensionException
* If the module does not exist.
*/
protected function getModulePath(string $module_name): string {
return \Drupal::service('extension.list.module')->getPath($module_name);
}
/**
* Gets the path for the specified theme.
*
* @param string $theme_name
* The theme name.
*
* @return string
* The Drupal-root relative path to the theme directory.
*
* @throws \Drupal\Core\Extension\Exception\UnknownExtensionException
* If the theme does not exist.
*/
protected function getThemePath(string $theme_name): string {
return \Drupal::service('extension.list.theme')->getPath($theme_name);
}
}