You are here

public function StableTemplateOverrideTest::testStableTemplateOverrides in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/KernelTests/Core/Theme/StableTemplateOverrideTest.php \Drupal\KernelTests\Core\Theme\StableTemplateOverrideTest::testStableTemplateOverrides()

Ensures that Stable overrides all relevant core templates.

File

core/tests/Drupal/KernelTests/Core/Theme/StableTemplateOverrideTest.php, line 90
Contains \Drupal\KernelTests\Core\Theme\StableTemplateOverrideTest.

Class

StableTemplateOverrideTest
Tests Stable's template overrides.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testStableTemplateOverrides() {
  $registry = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $this->themeHandler, \Drupal::service('theme.initialization'), 'stable');
  $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/stable', $info['theme path'], $info['template'] . '.html.twig overridden in Stable.');
    }
  }
}