You are here

public function ThemeInstallerTest::testUninstallNonExisting in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testUninstallNonExisting()
  2. 10 core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php \Drupal\KernelTests\Core\Theme\ThemeInstallerTest::testUninstallNonExisting()

Tests uninstalling a non-existing theme.

File

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

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testUninstallNonExisting() {
  $name = 'non_existing_theme';
  $themes = $this
    ->themeHandler()
    ->listInfo();
  $this
    ->assertEmpty(array_keys($themes));
  try {
    $message = 'ThemeInstaller::uninstall() throws UnknownExtensionException upon uninstalling a non-existing theme.';
    $this
      ->themeInstaller()
      ->uninstall([
      $name,
    ]);
    $this
      ->fail($message);
  } catch (\Exception $e) {
    $this
      ->assertInstanceOf(UnknownExtensionException::class, $e);
  }
  $themes = $this
    ->themeHandler()
    ->listInfo();
  $this
    ->assertEmpty(array_keys($themes));
}