class ModuleHandlerDeprecatedHookUnimplementedTest

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookUnimplementedTest.php \Drupal\KernelTests\Core\Extension\ModuleHandlerDeprecatedHookUnimplementedTest
  2. 10 core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookUnimplementedTest.php \Drupal\KernelTests\Core\Extension\ModuleHandlerDeprecatedHookUnimplementedTest
  3. 8.9.x core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookUnimplementedTest.php \Drupal\KernelTests\Core\Extension\ModuleHandlerDeprecatedHookUnimplementedTest

Test whether unimplemented deprecated hook invocations trigger errors.

@group Extension

@coversDefaultClass Drupal\Core\Extension\ModuleHandler

Hierarchy

Expanded class hierarchy of ModuleHandlerDeprecatedHookUnimplementedTest

File

core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookUnimplementedTest.php, line 15

Namespace

Drupal\KernelTests\Core\Extension
View source
class ModuleHandlerDeprecatedHookUnimplementedTest extends KernelTestBase {
  
  /**
   * @covers ::alterDeprecated
   * @covers ::invokeAllDeprecated
   * @covers ::invokeDeprecated
   */
  public function testUnimplementedHooks() {
    $unimplemented_hook_name = 'unimplemented_hook_name';
    /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */
    $module_handler = $this->container
      ->get('module_handler');
    $this->assertInstanceOf(ModuleHandlerInterface::class, $module_handler);
    $module_handler->invokeDeprecated('Use something else.', 'deprecation_test', $unimplemented_hook_name);
    $module_handler->invokeAllDeprecated('Use something else.', $unimplemented_hook_name);
    $data = [];
    $module_handler->alterDeprecated('Alter something else.', $unimplemented_hook_name, $data);
  }

}

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