function ModuleHandlerTest::testInvokeModuleEnabled

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

Tests invoke methods when module is enabled.

File

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

Class

ModuleHandlerTest
Tests Drupal\Core\Extension\ModuleHandler.

Namespace

Drupal\Tests\Core\Extension

Code

public function testInvokeModuleEnabled() : void {
  $module_handler = $this->getModuleHandler();
  $module_handler->loadAll();
  $this->assertTrue($module_handler->invoke('module_handler_test', 'hook', [
    TRUE,
  ]), 'Installed module runs hook.');
  $this->assertFalse($module_handler->invoke('module_handler_test', 'hook', [
    FALSE,
  ]), 'Installed module runs hook.');
  $this->assertNull($module_handler->invoke('module_handler_test_fake', 'hook', [
    FALSE,
  ]), 'Installed module runs hook.');
}

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