function ModuleHandlerTest::testLoadAllModules

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testLoadAllModules()
  2. 8.9.x core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testLoadAllModules()
  3. 10 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testLoadAllModules()

Tests loading all modules.

@covers ::loadAll

@group legacy

File

core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php, line 108

Class

ModuleHandlerTest
@coversDefaultClass \Drupal\Core\Extension\ModuleHandler[[api-linebreak]] @runTestsInSeparateProcesses

Namespace

Drupal\Tests\Core\Extension

Code

public function testLoadAllModules() : void {
  $moduleList = [
    'module_handler_test_all1' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1',
    'module_handler_test_all2' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all2',
  ];
  $module_handler = $this->getModuleHandler($moduleList);
  $module_handler->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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.