Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / Drupal / KernelTests / Core / Theme / RegistryTest.php
index f453852d2e9ac23074fb1b618010a9401380d223..7f6d2eccda8ededad48d4ebf6ce53ee612359874 100644 (file)
@@ -192,4 +192,23 @@ class RegistryTest extends KernelTestBase {
     ], $suggestions, 'Found expected page node suggestions.');
   }
 
+  /**
+   * Tests theme-provided templates that are registered by modules.
+   */
+  public function testThemeTemplatesRegisteredByModules() {
+    $theme_handler = \Drupal::service('theme_handler');
+    $theme_handler->install(['test_theme']);
+
+    $registry_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme');
+    $registry_theme->setThemeManager(\Drupal::theme());
+
+    $expected = [
+      'template_preprocess',
+      'template_preprocess_container',
+      'template_preprocess_theme_test_registered_by_module'
+    ];
+    $registry = $registry_theme->get();
+    $this->assertEquals($expected, array_values($registry['theme_test_registered_by_module']['preprocess functions']));
+  }
+
 }