You are here

public function RegistryLegacyTest::testMultipleSubThemes in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Theme/RegistryLegacyTest.php \Drupal\KernelTests\Core\Theme\RegistryLegacyTest::testMultipleSubThemes()

Tests the theme registry with theme functions and multiple subthemes.

File

core/tests/Drupal/KernelTests/Core/Theme/RegistryLegacyTest.php, line 30

Class

RegistryLegacyTest
Tests legacy behavior of the ThemeRegistry class.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testMultipleSubThemes() {
  $this
    ->expectDeprecation('Unsilenced deprecation: Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of theme_theme_test(). See https://www.drupal.org/node/1831138');
  $theme_handler = \Drupal::service('theme_handler');
  \Drupal::service('module_installer')
    ->install([
    'theme_legacy_test',
  ]);
  \Drupal::service('theme_installer')
    ->install([
    'test_basetheme',
  ]);
  $registry_base_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_basetheme');
  $registry_base_theme
    ->setThemeManager(\Drupal::theme());
  $preprocess_functions = $registry_base_theme
    ->get()['theme_test_function_suggestions']['preprocess functions'];
  $this
    ->assertSame([
    'template_preprocess_theme_test_function_suggestions',
    'test_basetheme_preprocess_theme_test_function_suggestions',
  ], $preprocess_functions, "Theme functions don't have template_preprocess but do have template_preprocess_HOOK");
}