You are here

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

Tests installing a non-existing theme.

File

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

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\system\Tests\Extension

Code

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