You are here

public function ModuleHandlerTest::testLoadAllModules in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testLoadAllModules()

Test loading all modules.

@covers ::loadAll

File

core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php, line 76
Contains \Drupal\Tests\Core\Extension\ModuleHandlerTest.

Class

ModuleHandlerTest
@coversDefaultClass \Drupal\Core\Extension\ModuleHandler @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testLoadAllModules() {
  $this->moduleHandler
    ->addModule('module_handler_test_all1', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1');
  $this->moduleHandler
    ->addModule('module_handler_test_all2', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all2');
  $this
    ->assertFalse(function_exists('module_handler_test_all1_hook'), 'Function does not exist before being loaded.');
  $this
    ->assertFalse(function_exists('module_handler_test_all2_hook'), 'Function does not exist before being loaded.');
  $this->moduleHandler
    ->loadAll();
  $this
    ->assertTrue(function_exists('module_handler_test_all1_hook'), 'Function exists after being loaded.');
  $this
    ->assertTrue(function_exists('module_handler_test_all2_hook'), 'Function exists after being loaded.');
}