You are here

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

Tests installing a theme with a too long name.

File

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

Class

ThemeInstallerTest
Tests installing and uninstalling of themes.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testInstallNameTooLong() {
  $name = 'test_theme_having_veery_long_name_which_is_too_long';
  try {
    $message = 'ThemeInstaller::install() throws ExtensionNameLengthException upon installing a theme with a too long name.';
    $this
      ->themeInstaller()
      ->install([
      $name,
    ]);
    $this
      ->fail($message);
  } catch (\Exception $e) {
    $this
      ->assertInstanceOf(ExtensionNameLengthException::class, $e);
  }
}