diff -u b/core/lib/Drupal/Core/Utility/ThemeRegistry.php b/core/lib/Drupal/Core/Utility/ThemeRegistry.php --- b/core/lib/Drupal/Core/Utility/ThemeRegistry.php +++ b/core/lib/Drupal/Core/Utility/ThemeRegistry.php @@ -56,12 +56,13 @@ /** * Constructs a ThemeRegistry object. * + * + * @param string $cid + * The cid for the array being cached. * @param \Drupal\Core\Cache\CacheBackendInterface $cache * The cache backend. * @param \Drupal\Core\Lock\LockBackendInterface $lock * The lock backend. - * @param \Drupal\Core\Theme\ActiveTheme $theme - * The theme object representing the active theme for this registry. * @param array $tags * (optional) The tags to specify for the cache item. * @param bool $modules_loaded only in patch2: unchanged: --- a/core/modules/system/src/Tests/Theme/RegistryTest.php +++ b/core/modules/system/src/Tests/Theme/RegistryTest.php @@ -41,11 +41,13 @@ function testRaceCondition() { $cache = \Drupal::cache(); $lock_backend = \Drupal::lock(); $registry = new ThemeRegistry($cid, $cache, $lock_backend, array('theme_registry'), $this->container->get('module_handler')->isLoaded()); - - $this->assertTrue(\Drupal::cache()->get($cid), 'Cache entry was created.'); + // Test that lazy loading works. + $this->assertFalse(\Drupal::cache()->get($cid), 'Cache entry was not created by default.'); // Trigger a cache miss for an offset. $this->assertTrue($registry->get('theme_test_template_test'), 'Offset was returned correctly from the theme registry.'); + // After registry has been actually used we should have a cache entry. + $this->assertTrue(\Drupal::cache()->get($cid), 'Cache entry was created.'); // This will cause the ThemeRegistry class to write an updated version of // the cache entry when it is destroyed, usually at the end of the request. // Before that happens, manually delete the cache entry we created earlier