function Stable9TemplateOverrideTest::testStable9TemplateOverrides

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/Stable9TemplateOverrideTest.php \Drupal\KernelTests\Core\Theme\Stable9TemplateOverrideTest::testStable9TemplateOverrides()
  2. 11.x core/tests/Drupal/KernelTests/Core/Theme/Stable9TemplateOverrideTest.php \Drupal\KernelTests\Core\Theme\Stable9TemplateOverrideTest::testStable9TemplateOverrides()

Ensures that Stable 9 overrides all relevant core templates.

File

core/tests/Drupal/KernelTests/Core/Theme/Stable9TemplateOverrideTest.php, line 94

Class

Stable9TemplateOverrideTest
Tests Stable 9's template overrides.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testStable9TemplateOverrides() : void {
    $registry = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $this->themeHandler, \Drupal::service('theme.initialization'), \Drupal::service('cache.bootstrap'), \Drupal::service('extension.list.module'), \Drupal::service('kernel'), 'stable9');
    $registry->setThemeManager(\Drupal::theme());
    $registry_full = $registry->get();
    foreach ($registry_full as $hook => $info) {
        if (isset($info['template'])) {
            // Allow skipping templates.
            if (in_array($info['template'], $this->templatesToSkip)) {
                continue;
            }
            $this->assertEquals('core/themes/stable9', $info['theme path'], $info['template'] . '.html.twig overridden in Stable 9.');
        }
    }
}

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