function ModuleImplementsAlterTest::testModuleImplementsAlterNonExistingImplementation in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php \Drupal\system\Tests\Module\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/
modules/ system/ src/ Tests/ Module/ ModuleImplementsAlterTest.php, line 76 - Contains \Drupal\system\Tests\Module\ModuleImplementsAlterTest.
Class
Namespace
Drupal\system\Tests\ModuleCode
function testModuleImplementsAlterNonExistingImplementation() {
// Install the module_test module.
\Drupal::service('module_installer')
->install(array(
'module_test',
));
try {
// Trigger hook discovery.
\Drupal::moduleHandler()
->getImplementations('unimplemented_test_hook');
$this
->fail('An exception should be thrown for the non-existing implementation.');
} catch (\RuntimeException $e) {
$this
->pass('An exception should be thrown for the non-existing implementation.');
$this
->assertEqual($e
->getMessage(), 'An invalid implementation module_test_unimplemented_test_hook was added by hook_module_implements_alter()');
}
}