You are here

public function RegistryTest::testThemeRegistryAlterByTheme in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::testThemeRegistryAlterByTheme()

Tests that the theme registry can be altered by themes.

File

core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php, line 142

Class

RegistryTest
Tests the behavior of the ThemeRegistry class.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testThemeRegistryAlterByTheme() {

  /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
  $theme_handler = \Drupal::service('theme_handler');
  \Drupal::service('theme_installer')
    ->install([
    'test_theme',
  ]);
  $this
    ->config('system.theme')
    ->set('default', 'test_theme')
    ->save();
  $registry = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme');
  $registry
    ->setThemeManager(\Drupal::theme());
  $this
    ->assertEqual('value', $registry
    ->get()['theme_test_template_test']['variables']['additional']);
}