function ModuleHandlerTest::testImplementsHookModuleEnabled
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testImplementsHookModuleEnabled()
- 8.9.x core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testImplementsHookModuleEnabled()
- 10 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testImplementsHookModuleEnabled()
Tests implementations methods when module is enabled.
@covers ::hasImplementations
@covers ::loadAllIncludes
File
-
core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleHandlerTest.php, line 337
Class
- ModuleHandlerTest
- @coversDefaultClass \Drupal\Core\Extension\ModuleHandler[[api-linebreak]] @runTestsInSeparateProcesses
Namespace
Drupal\Tests\Core\ExtensionCode
public function testImplementsHookModuleEnabled() : void {
$implementations = [
'module_handler_test_hook' => 'module_handler_test',
'module_handler_test_added_hook' => 'module_handler_test_added',
];
$moduleList = [
'module_handler_test_added' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added',
'module_handler_test_no_hook' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_no_hook',
];
$module_handler = $this->getModuleHandler($moduleList, $implementations);
$this->assertTrue($module_handler->hasImplementations('hook', 'module_handler_test'), 'Installed module implementation found.');
$this->assertTrue($module_handler->hasImplementations('hook', 'module_handler_test_added'), 'Runtime added module with implementation in include found.');
$this->assertFalse($module_handler->hasImplementations('hook', 'module_handler_test_no_hook'), 'Missing implementation not found.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.