function ModuleHandlerTest::testInvokeAll

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

Tests invoke all.

@legacy-covers ::invokeAll

Attributes

#[IgnoreDeprecations]

File

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

Class

ModuleHandlerTest
Tests Drupal\Core\Extension\ModuleHandler.

Namespace

Drupal\Tests\Core\Extension

Code

public function testInvokeAll() : void {
  $implementations = [
    'module_handler_test_hook' => 'module_handler_test',
    'module_handler_test_all1_hook' => 'module_handler_test_all1',
    'module_handler_test_all2_hook' => 'module_handler_test_all2',
  ];
  $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, $implementations);
  $this->assertEquals([
    TRUE,
    TRUE,
    TRUE,
  ], $module_handler->invokeAll('hook', [
    TRUE,
  ]));
}

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