public function ModuleHandlerTest::testLoadModule in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testLoadModule()
Test loading a module.
@covers ::load
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleHandlerTest.php, line 57 - Contains \Drupal\Tests\Core\Extension\ModuleHandlerTest.
Class
- ModuleHandlerTest
- @coversDefaultClass \Drupal\Core\Extension\ModuleHandler @group Extension
Namespace
Drupal\Tests\Core\ExtensionCode
public function testLoadModule() {
$this
->assertFalse(function_exists('module_handler_test_hook'));
$this
->assertTrue($this->moduleHandler
->load('module_handler_test'));
$this
->assertTrue(function_exists('module_handler_test_hook'));
$this->moduleHandler
->addModule('module_handler_test_added', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added');
$this
->assertFalse(function_exists('module_handler_test_added_hook'), 'Function does not exist before being loaded.');
$this
->assertTrue($this->moduleHandler
->load('module_handler_test_added'));
$this
->assertTrue(function_exists('module_handler_test_added_helper'), 'Function exists after being loaded.');
$this
->assertTrue($this->moduleHandler
->load('module_handler_test_added'));
$this
->assertFalse($this->moduleHandler
->load('module_handler_test_dne'), 'Non-existent modules returns false.');
}