diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleEnable.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleEnable.php index b2d08fc..1b41d3e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleEnable.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleEnable.php @@ -44,4 +44,19 @@ function testRequiredModuleSchemaVersions() { $this->assertTrue($version > 0, 'User module version is > 0.'); } + /** + * Tests that an exception is thrown when a module name is too long. + */ + function testModuleNameLength() { + $module_name = 'invalid_module_name_over_the_maximum_allowed_character_length'; + $message = format_string('Exception thrown when enabling module %name with a name length over the allowed maximum', array('%name' => $module_name)); + try { + module_enable(array($module_name)); + $this->fail($message); + } + catch (\Exception $e) { + $this->pass($message); + } + } + }