function RegistryLegacyTest::testMultipleSubThemes

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

Tests the theme registry with theme functions and multiple subthemes.

@expectedDeprecation 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

File

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

Class

RegistryLegacyTest
Tests legacy behavior of the ThemeRegistry class.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testMultipleSubThemes() {
    $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");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.