/** * Ensures that Stable overrides all relevant core templates. */ 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.'); } } }
/** * Tests that the theme registry can be altered by themes. */ public function testThemeRegistryAlterByTheme() { /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */ $theme_handler = \Drupal::service('theme_handler'); $theme_handler->install(['test_theme']); $theme_handler->setDefault('test_theme'); $registry = new Registry(\Drupal::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']); }