public function ModuleImplementsAlterTest::testModuleImplementsAlterNonExistingImplementation in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php \Drupal\KernelTests\Core\Extension\ModuleImplementsAlterTest::testModuleImplementsAlterNonExistingImplementation()
- 10 core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php \Drupal\KernelTests\Core\Extension\ModuleImplementsAlterTest::testModuleImplementsAlterNonExistingImplementation()
Tests what happens if hook_module_implements_alter() adds a non-existing function to the implementations.
See also
\Drupal\Core\Extension\ModuleHandler::buildImplementationInfo()
module_test_module_implements_alter()
File
- core/
tests/ Drupal/ KernelTests/ Core/ Extension/ ModuleImplementsAlterTest.php, line 73
Class
Namespace
Drupal\KernelTests\Core\ExtensionCode
public function testModuleImplementsAlterNonExistingImplementation() {
// Install the module_test module.
\Drupal::service('module_installer')
->install([
'module_test',
]);
// Trigger hook discovery.
$this
->expectException(\RuntimeException::class);
$this
->expectExceptionMessage('An invalid implementation module_test_unimplemented_test_hook was added by hook_module_implements_alter()');
\Drupal::moduleHandler()
->getImplementations('unimplemented_test_hook');
}