function InstallTest::testInstallModuleSameNameAsTheme
Same name in other branches
- 11.x core/modules/system/tests/src/Kernel/Module/InstallTest.php \Drupal\Tests\system\Kernel\Module\InstallTest::testInstallModuleSameNameAsTheme()
Tests installing a module with the same name as an enabled theme.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Module/ InstallTest.php, line 128
Class
- InstallTest
- Tests the installation of modules.
Namespace
Drupal\Tests\system\Kernel\ModuleCode
public function testInstallModuleSameNameAsTheme() : void {
$name = 'name_collision_test';
// Install and uninstall the module.
$this->moduleInstaller
->install([
$name,
]);
$this->moduleInstaller
->uninstall([
$name,
]);
// Install the theme, then the module.
$this->container
->get('theme_installer')
->install([
$name,
]);
$message = "Module name {$name} is already in use by an installed theme.";
$this->expectException(ExtensionNameReservedException::class);
$this->expectExceptionMessage($message);
$this->moduleInstaller
->install([
$name,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.