diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index 907ea6d..f347bee 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -225,9 +225,10 @@ protected function loadOverrides(array $names) { */ protected function propagateCacheableDependencyOverrides($cache_key) { foreach ($this->configFactoryOverrides as $override) { - $this->cache[$cache_key]->addCacheContexts($override->getCacheContexts()); - $this->cache[$cache_key]->addCacheTags($override->getCacheTags()); - $this->cache[$cache_key]->setCacheMaxAgeIfLower($override->getCacheMaxAge()); + $this->cache[$cache_key] + ->addCacheContexts($override->getCacheContexts()) + ->addCacheTags($override->getCacheTags()) + ->setCacheMaxAgeIfLower($override->getCacheMaxAge()); } } diff --git a/core/modules/config/src/Tests/CacheContextConfigOverrideTest.php b/core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideTest.php similarity index 85% rename from core/modules/config/src/Tests/CacheContextConfigOverrideTest.php rename to core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideTest.php index 4782a51..9495a87 100644 --- a/core/modules/config/src/Tests/CacheContextConfigOverrideTest.php +++ b/core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\config\Tests\CacheContextConfigOverrideTest. + * Contains \Drupal\config\Tests\CacheabilityMetadataConfigOverrideTest. */ namespace Drupal\config\Tests; @@ -12,11 +12,11 @@ use Drupal\simpletest\KernelTestBase; /** - * Tests configuration overrides that set cache contexts. + * Tests if configuration overrides correctly affect cacheability metadata. * * @group config */ -class CacheContextConfigOverrideTest extends KernelTestBase { +class CacheabilityMetadataConfigOverrideTest extends KernelTestBase { /** * {@inheritdoc} @@ -38,6 +38,9 @@ public function setUp() { $this->installConfig(['config_override_test']); } + /** + * Tests if config overrides correctly set cacheability metadata. + */ public function testConfigOverride() { // It's pirate day today! $GLOBALS['it_is_pirate_day'] = TRUE; @@ -49,7 +52,7 @@ public function testConfigOverride() { $theme = $config->get('default'); $this->assertEqual('pirate', $theme); - // Check that the cacheable properties are correct. + // Check that the cacheability properties are correct. $this->assertEqual(['pirate_day'], $config->getCacheContexts()); $this->assertEqual(['config:system.theme', 'pirate-day-tag'], $config->getCacheTags()); $this->assertEqual(PirateDayCacheContext::PIRATE_DAY_MAX_AGE, $config->getCacheMaxAge()); diff --git a/core/modules/config/tests/config_override_test/src/PirateDayCacheContextConfigOverride.php b/core/modules/config/tests/config_override_test/src/PirateDayCacheContextConfigOverride.php index 21cc846..e884dcb 100644 --- a/core/modules/config/tests/config_override_test/src/PirateDayCacheContextConfigOverride.php +++ b/core/modules/config/tests/config_override_test/src/PirateDayCacheContextConfigOverride.php @@ -12,7 +12,7 @@ use Drupal\Core\Config\StorageInterface; /** - * Test implementation of a cache context providing config override. + * Test implementation of a config override that provides cacheability metadata. */ class PirateDayCacheContextConfigOverride implements ConfigFactoryOverrideInterface { @@ -20,7 +20,7 @@ class PirateDayCacheContextConfigOverride implements ConfigFactoryOverrideInterf * {@inheritdoc} */ public function loadOverrides($names) { - $overrides = array(); + $overrides = []; // Override the theme and the 'call_to_action' block on Pirate Day. if (PirateDayCacheContext::isPirateDay()) {