function ThemeInstallerTest::testInstallThemeSameNameAsModule
Tests installing a theme with the same name as an enabled module.
File
- 
              core/tests/ Drupal/ KernelTests/ Core/ Theme/ ThemeInstallerTest.php, line 160 
Class
- ThemeInstallerTest
- Tests installing and uninstalling of themes.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testInstallThemeSameNameAsModule() : void {
  $name = 'name_collision_test';
  // Install and uninstall the theme.
  $this->themeInstaller()
    ->install([
    $name,
  ]);
  $this->themeInstaller()
    ->uninstall([
    $name,
  ]);
  // Install the module, then the theme.
  $this->moduleInstaller()
    ->install([
    $name,
  ]);
  $message = "Theme name {$name} is already in use by an installed module.";
  $this->expectException(ExtensionNameReservedException::class);
  $this->expectExceptionMessage($message);
  $this->themeInstaller()
    ->install([
    $name,
  ]);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
