function ModuleHandlerTest::testModuleReloading

Tests reload method.

@legacy-covers ::reload

File

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

Class

ModuleHandlerTest
Tests Drupal\Core\Extension\ModuleHandler.

Namespace

Drupal\Tests\Core\Extension

Code

public function testModuleReloading() : void {
  $module_handler = $this->getMockBuilder(ModuleHandler::class)
    ->setConstructorArgs([
    $this->root,
    [
      'module_handler_test' => [
        'type' => 'module',
        'pathname' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml',
        'filename' => 'module_handler_test.module',
      ],
    ],
    $this->eventDispatcher,
    [],
  ])
    ->onlyMethods([
    'load',
  ])
    ->getMock();
  $calls = [
    'module_handler_test',
  ];
  $module_handler->expects($this->once())
    ->method('load')
    ->with($this->callback(function (string $module) use (&$calls) : bool {
    return $module === array_shift($calls);
  }));
  $module_handler->reload();
}

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