Skip to content
Snippets Groups Projects
Verified Commit 6cbe4eac authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3000677 by catch, Shane Birley, featherbelly, alexpott: Fatal error...

Issue #3000677 by catch, Shane Birley, featherbelly, alexpott: Fatal error after upgrade to 8.6x [due to regression in extension system]
parent 79776268
No related branches found
No related tags found
No related merge requests found
......@@ -747,7 +747,13 @@ public function getModuleDirectories() {
* {@inheritdoc}
*/
public function getName($module) {
return \Drupal::service('extension.list.module')->getName($module);
try {
return \Drupal::service('extension.list.module')->getName($module);
}
catch (UnknownExtensionException $e) {
@trigger_error('Calling ModuleHandler::getName() with an unknown module is deprecated in Drupal 8.7.0 and support for this will be removed in Drupal 9.0.0, check that the module exists before calling this method. See https://www.drupal.org/node/3024541.', E_USER_DEPRECATED);
return $module;
}
}
}
<?php
namespace Drupal\KernelTests\Core\Extension;
use Drupal\KernelTests\KernelTestBase;
/**
* @coversDefaultClass \Drupal\Core\Extension\ModuleHandler
*
* @group Extension
*/
class ModuleHandlerTest extends KernelTestBase {
/**
* Tests requesting the name of an invalid module.
*
* @covers ::getName
* @group legacy
* @expectedDeprecation Calling ModuleHandler::getName() with an unknown module is deprecated in Drupal 8.7.0 and support for this will be removed in Drupal 9.0.0, check that the module exists before calling this method. See https://www.drupal.org/node/3024541.
*/
public function testInvalidGetName() {
$module_handler = $this->container->get('module_handler');
$this->assertSame('module_nonsense', $module_handler->getName('module_nonsense'));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment