You are here

function ThemeInstallerTest::testUninstall in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Extension/ThemeInstallerTest.php \Drupal\system\Tests\Extension\ThemeInstallerTest::testUninstall()

Tests uninstalling a theme.

File

core/modules/system/src/Tests/Extension/ThemeInstallerTest.php, line 267
Contains \Drupal\system\Tests\Extension\ThemeInstallerTest.

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\system\Tests\Extension

Code

function testUninstall() {
  $name = 'test_basetheme';
  $this
    ->themeInstaller()
    ->install(array(
    $name,
  ));
  $this
    ->assertTrue($this
    ->config("{$name}.settings")
    ->get());
  $this
    ->themeInstaller()
    ->uninstall(array(
    $name,
  ));
  $this
    ->assertFalse(array_keys($this
    ->themeHandler()
    ->listInfo()));
  $this
    ->assertFalse(array_keys(system_list('theme')));
  $this
    ->assertFalse($this
    ->config("{$name}.settings")
    ->get());

  // Ensure that the uninstalled theme can be installed again.
  $this
    ->themeInstaller()
    ->install(array(
    $name,
  ));
  $themes = $this
    ->themeHandler()
    ->listInfo();
  $this
    ->assertTrue(isset($themes[$name]));
  $this
    ->assertEqual($themes[$name]
    ->getName(), $name);
  $this
    ->assertEqual(array_keys(system_list('theme')), array_keys($themes));
  $this
    ->assertTrue($this
    ->config("{$name}.settings")
    ->get());
}