You are here

public function ModuleHandlerTest::testInvokeModuleEnabled in Drupal 8

Test invoke methods when module is enabled.

@covers ::invoke

File

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

Class

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

Namespace

Drupal\Tests\Core\Extension

Code

public function testInvokeModuleEnabled() {
  $module_handler = $this
    ->getModuleHandler();
  $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.');
}