function RendererBubblingTest::testContextBubblingEdgeCases
Same name and namespace in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php \Drupal\Tests\Core\Render\RendererBubblingTest::testContextBubblingEdgeCases()
- 10 core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php \Drupal\Tests\Core\Render\RendererBubblingTest::testContextBubblingEdgeCases()
- 11.x core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php \Drupal\Tests\Core\Render\RendererBubblingTest::testContextBubblingEdgeCases()
Tests cache context bubbling in edge cases, because it affects the CID.
::testBubblingWithPrerender() already tests the common case.
@dataProvider providerTestContextBubblingEdgeCases
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ RendererBubblingTest.php, line 137
Class
- RendererBubblingTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Render%21Renderer.php/class/Renderer/9" title="Turns a render array into an HTML string." class="local">\Drupal\Core\Render\Renderer</a> @group Render
Namespace
Drupal\Tests\Core\RenderCode
public function testContextBubblingEdgeCases(array $element, array $expected_top_level_contexts, array $expected_cache_items) {
$this->setUpRequest();
$this->setupMemoryCache();
$this->cacheContextsManager
->expects($this->any())
->method('convertTokensToKeys')
->willReturnArgument(0);
$this->renderer
->renderRoot($element);
$this->assertEqualsCanonicalizing($expected_top_level_contexts, $element['#cache']['contexts'], 'Expected cache contexts found.');
foreach ($expected_cache_items as $cid => $expected_cache_item) {
$this->assertRenderCacheItem($cid, $expected_cache_item);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.