function ModuleHandlerTest::testLoadModule
Tests loading a module.
@legacy-covers ::load
File
-
core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleHandlerTest.php, line 90
Class
Namespace
Drupal\Tests\Core\ExtensionCode
public function testLoadModule() : void {
$moduleList = [
'module_handler_test_added' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added',
];
$module_handler = $this->getModuleHandler($moduleList);
$this->assertTrue($module_handler->load('module_handler_test'));
$this->assertTrue(function_exists('module_handler_test_hook'));
$this->assertTrue($module_handler->load('module_handler_test_added'));
$this->assertTrue(function_exists('module_handler_test_added_helper'), 'Function exists after being loaded.');
$this->assertTrue($module_handler->load('module_handler_test_added'));
$this->assertFalse($module_handler->load('module_handler_test_dne'), 'Non-existent modules returns false.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.