function ThemeInstallerTest::testInstall

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testInstall()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testInstall()
  3. 10 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testInstall()

Tests installing a theme.

File

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

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testInstall() : void {
    $name = 'test_base_theme';
    $themes = $this->themeHandler()
        ->listInfo();
    $this->assertFalse(isset($themes[$name]));
    $this->themeInstaller()
        ->install([
        $name,
    ]);
    $this->assertSame(0, $this->extensionConfig()
        ->get("theme.{$name}"));
    $themes = $this->themeHandler()
        ->listInfo();
    $this->assertTrue(isset($themes[$name]));
    $this->assertEquals($name, $themes[$name]->getName());
    // Verify that test_base_theme.settings is active.
    $this->assertFalse(theme_get_setting('features.favicon', $name));
    $this->assertEquals('only', theme_get_setting('base', $name));
    $this->assertEquals('base', theme_get_setting('override', $name));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.