function CacheTest::testTimeResultCachingWithPager
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/Plugin/CacheTest.php \Drupal\Tests\views\Kernel\Plugin\CacheTest::testTimeResultCachingWithPager()
- 8.9.x core/modules/views/tests/src/Kernel/Plugin/CacheTest.php \Drupal\Tests\views\Kernel\Plugin\CacheTest::testTimeResultCachingWithPager()
- 10 core/modules/views/tests/src/Kernel/Plugin/CacheTest.php \Drupal\Tests\views\Kernel\Plugin\CacheTest::testTimeResultCachingWithPager()
Tests result caching with a pager.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Plugin/ CacheTest.php, line 184
Class
- CacheTest
- Tests pluggable caching for views.
Namespace
Drupal\Tests\views\Kernel\PluginCode
public function testTimeResultCachingWithPager() : void {
$view = Views::getView('test_cache');
$view->setDisplay();
$view->display_handler
->overrideOption('cache', [
'type' => 'time',
'options' => [
'results_lifespan' => '3600',
'output_lifespan' => '3600',
],
]);
$mapping = [
'views_test_data_name' => 'name',
];
$view->setDisplay('page_1');
$view->setCurrentPage(0);
$this->executeView($view);
$this->assertIdenticalResultset($view, [
[
'name' => 'John',
],
[
'name' => 'George',
],
], $mapping);
$view->destroy();
$view->setDisplay('page_1');
$view->setCurrentPage(1);
$this->executeView($view);
$this->assertIdenticalResultset($view, [
[
'name' => 'Ringo',
],
[
'name' => 'Paul',
],
], $mapping);
$view->destroy();
$view->setDisplay('page_1');
$view->setCurrentPage(0);
$this->executeView($view);
$this->assertIdenticalResultset($view, [
[
'name' => 'John',
],
[
'name' => 'George',
],
], $mapping);
$view->destroy();
$view->setDisplay('page_1');
$view->setCurrentPage(2);
$this->executeView($view);
$this->assertIdenticalResultset($view, [
[
'name' => 'Meredith',
],
], $mapping);
$view->destroy();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.