You are here

function ThemeInstallerTest::testUninstallNonExisting 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::testUninstallNonExisting()

Tests uninstalling a non-existing theme.

File

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

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\system\Tests\Extension

Code

function testUninstallNonExisting() {
  $name = 'non_existing_theme';
  $themes = $this
    ->themeHandler()
    ->listInfo();
  $this
    ->assertFalse(array_keys($themes));
  try {
    $message = 'ThemeHandler::uninstall() throws InvalidArgumentException upon uninstalling a non-existing theme.';
    $this
      ->themeInstaller()
      ->uninstall(array(
      $name,
    ));
    $this
      ->fail($message);
  } catch (\InvalidArgumentException $e) {
    $this
      ->pass(get_class($e) . ': ' . $e
      ->getMessage());
  }
  $themes = $this
    ->themeHandler()
    ->listInfo();
  $this
    ->assertFalse(array_keys($themes));
}