function ThemeInstallerTest::testInstallThemeSameNameAsModule

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testInstallThemeSameNameAsModule()

Tests installing a theme with the same name as an enabled module.

File

core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php, line 157

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\KernelTests\Core\Theme

Code

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.