public function CacheTest::testTimeResultCachingWithPager in Drupal 8
Same name and namespace in other branches
- 9 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() {
$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();
}