diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php index d659849..1e137d4 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php @@ -179,6 +179,7 @@ public function providerTestContextBubblingEdgeCases() { 'max-age' => Cache::PERMANENT, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ], ]; $data[] = [$test_element, [], $expected_cache_items]; @@ -202,6 +203,7 @@ public function providerTestContextBubblingEdgeCases() { 'max-age' => Cache::PERMANENT, ], '#markup' => '', + '#safe_cache_properties' => ['#markup'], ], ]; $context_orders = [ @@ -243,6 +245,7 @@ public function providerTestContextBubblingEdgeCases() { 'max-age' => 3600, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ], ]; $data[] = [$test_element, ['bar', 'baz', 'foo'], $expected_cache_items]; @@ -291,6 +294,7 @@ public function providerTestContextBubblingEdgeCases() { 'max-age' => Cache::PERMANENT, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ], ]; $data[] = [$test_element, ['bar', 'foo'], $expected_cache_items]; @@ -370,6 +374,7 @@ public function testConditionalCacheContextBubblingSelfHealing() { 'max-age' => Cache::PERMANENT, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ]); // Request 2: role B, the grandchild is accessible => bubbled cache @@ -395,6 +400,7 @@ public function testConditionalCacheContextBubblingSelfHealing() { 'max-age' => 1800, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ]); // Request 3: role A again, the grandchild is inaccessible again => bubbled @@ -431,6 +437,7 @@ public function testConditionalCacheContextBubblingSelfHealing() { 'max-age' => Cache::PERMANENT, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ]); // Request 4: role C, both the grandchild and the grandgrandchild are @@ -458,6 +465,7 @@ public function testConditionalCacheContextBubblingSelfHealing() { 'max-age' => 300, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ]); // Request 5: role A again, verifying the merging like we did for request 3. @@ -477,6 +485,7 @@ public function testConditionalCacheContextBubblingSelfHealing() { 'max-age' => Cache::PERMANENT, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ]); // Request 6: role B again, verifying the merging like we did for request 3. @@ -496,6 +505,7 @@ public function testConditionalCacheContextBubblingSelfHealing() { 'max-age' => 1800, ], '#markup' => 'parent', + '#safe_cache_properties' => ['#markup'], ]); } @@ -529,7 +539,7 @@ public function testBubblingWithPrerender($test_element) { // - … is not cached DOES get called. \Drupal::state()->set('bubbling_nested_pre_render_cached', FALSE); \Drupal::state()->set('bubbling_nested_pre_render_uncached', FALSE); - $this->memoryCache->set('cached_nested', ['#markup' => 'Cached nested!', '#attached' => [], '#cache' => ['contexts' => [], 'tags' => []]]); + $this->memoryCache->set('cached_nested', ['#markup' => 'Cached nested!', '#attached' => [], '#cache' => ['contexts' => [], 'tags' => []], '#safe_cache_properties' => ['#markup']]); // Simulate the rendering of an entire response (i.e. a root call). $output = $this->renderer->renderRoot($test_element); diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php index a3fe908..2af598c 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php @@ -137,6 +137,7 @@ public function providerPlaceholders() { 'tags' => [], 'max-age' => Cache::PERMANENT, ], + '#safe_cache_properties' => ['#markup'], ], ]; @@ -179,6 +180,7 @@ public function providerPlaceholders() { 'tags' => [], 'max-age' => Cache::PERMANENT, ], + '#safe_cache_properties' => ['#markup'], ], ]; @@ -312,6 +314,7 @@ public function testCacheableParent($test_element, $args, $placeholder_cid_keys, 'tags' => [], 'max-age' => Cache::PERMANENT, ], + '#safe_cache_properties' => ['#markup'], ]; $expected_element['#attached']['placeholders'][$expected_placeholder_markup] = $expected_placeholder_render_array; $this->assertEquals($cached_element, $expected_element, 'The correct data is cached: the stored #markup and #attached properties are not affected by placeholder #lazy_builder callbacks.'); @@ -579,6 +582,7 @@ public function testRenderChildrenPlaceholdersDifferentArguments() { 'tags' => [], 'max-age' => Cache::PERMANENT, ], + '#safe_cache_properties' => ['#markup'], ]; $dom = Html::load($cached_element['#markup']);