function RendererTest::testRenderCacheMaxAge
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderCacheMaxAge()
- 10 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderCacheMaxAge()
- 11.x core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderCacheMaxAge()
@covers ::render @covers ::doRender @covers \Drupal\Core\Render\RenderCache::get @covers \Drupal\Core\Render\RenderCache::set @covers \Drupal\Core\Render\RenderCache::createCacheID
@dataProvider providerTestRenderCacheMaxAge
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTest.php, line 853
Class
- RendererTest
- @coversDefaultClass \Drupal\Core\Render\Renderer @group Render
Namespace
Drupal\Tests\Core\RenderCode
public function testRenderCacheMaxAge($max_age, $is_render_cached, $render_cache_item_expire) {
$this->setUpRequest();
$this->setupMemoryCache();
$element = [
'#cache' => [
'keys' => [
'render_cache_test',
],
'max-age' => $max_age,
],
'#markup' => '',
];
$this->renderer
->renderRoot($element);
$cache_item = $this->cacheFactory
->get('render')
->get('render_cache_test:en:stark');
if (!$is_render_cached) {
$this->assertFalse($cache_item);
}
else {
$this->assertNotFalse($cache_item);
$this->assertSame($render_cache_item_expire, $cache_item->expire);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.