public function ViewExecutableTest::testSetCurrentPageDuringPreRender in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testSetCurrentPageDuringPreRender()
@covers ::setCurrentPage @covers ::getCurrentPage
File
- core/
modules/ views/ tests/ src/ Unit/ ViewExecutableTest.php, line 624
Class
- ViewExecutableTest
- @coversDefaultClass \Drupal\views\ViewExecutable @group views
Namespace
Drupal\Tests\views\UnitCode
public function testSetCurrentPageDuringPreRender() {
/** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */
/** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */
list($view, $display) = $this
->setupBaseViewAndDisplay();
$elements =& $view->element;
$elements['#cache'] += [
'keys' => [],
];
$elements['#pre_rendered'] = TRUE;
$view
->setCurrentPage(12);
$this
->assertEquals(12, $view
->getCurrentPage());
$this
->assertNotContains('page:12', $view->element['#cache']['keys']);
}