function ModuleHandlerTest::testLoadAllIncludes

Tests load all includes.

@legacy-covers ::loadAllIncludes

Attributes

#[IgnoreDeprecations]

File

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

Class

ModuleHandlerTest
Tests Drupal\Core\Extension\ModuleHandler.

Namespace

Drupal\Tests\Core\Extension

Code

public function testLoadAllIncludes() : void {
  $this->expectDeprecation('ModuleHandler::loadAllIncludes() is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. There is no replacement. See https://www.drupal.org/node/3536432');
  $this->assertTrue(TRUE);
  $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',
      ],
    ],
    new KeyValueMemoryFactory(),
    $this->createMock(CallableResolver::class),
    new NullBackend('bootstrap'),
  ])
    ->onlyMethods([
    'loadInclude',
  ])
    ->getMock();
  // Ensure we reset implementations when settings a new modules list.
  $module_handler->expects($this->once())
    ->method('loadInclude');
  $module_handler->loadAllIncludes('hook');
}

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