You are here

public function ModuleHandlerDeprecatedHookTest::testInvokeDeprecated in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookTest.php \Drupal\KernelTests\Core\Extension\ModuleHandlerDeprecatedHookTest::testInvokeDeprecated()

@covers ::invokeDeprecated

File

core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookTest.php, line 22

Class

ModuleHandlerDeprecatedHookTest
Test whether deprecated hook invocations trigger errors.

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testInvokeDeprecated() {
  $this
    ->expectDeprecation('The deprecated hook hook_deprecated_hook() is implemented in these functions: deprecation_test_deprecated_hook(). Use something else.');

  /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */
  $module_handler = $this->container
    ->get('module_handler');
  $arg = 'an_arg';
  $this
    ->assertEquals($arg, $module_handler
    ->invokeDeprecated('Use something else.', 'deprecation_test', 'deprecated_hook', [
    $arg,
  ]));
}