private function MenuLinkFormatterTest::getExtensionsForModules in Menu Link (Field) 8
Returns Extension objects for $modules to enable.
Parameters
string[] $modules: The list of modules to enable.
Return value
\Drupal\Core\Extension\Extension[] Extension objects for $modules, keyed by module name.
Throws
\PHPUnit\Framework\Exception If a module is not available.
Overrides KernelTestBase::getExtensionsForModules
See also
\Drupal\Tests\KernelTestBase::enableModules()
\Drupal\Core\Extension\ModuleHandler::add()
1 call to MenuLinkFormatterTest::getExtensionsForModules()
- MenuLinkFormatterTest::bootKernel in tests/
src/ Kernel/ MenuLinkFormatterTest.php - Bootstraps a kernel for a test.
File
- tests/
src/ Kernel/ MenuLinkFormatterTest.php, line 201
Class
- MenuLinkFormatterTest
- Tests the menu link field formatters.
Namespace
Drupal\Tests\menu_link\KernelCode
private function getExtensionsForModules(array $modules) : array {
$extensions = [];
$discovery = new ExtensionDiscovery($this->root);
$discovery
->setProfileDirectories([]);
$list = $discovery
->scan('module');
foreach ($modules as $name) {
if (!isset($list[$name])) {
throw new Exception("Unavailable module: '{$name}'. If this module needs to be downloaded separately, annotate the test class with '@requires module {$name}'.");
}
$extensions[$name] = $list[$name];
}
return $extensions;
}