function ViewExecutableTest::testSetCurrentPageBeforePreRender

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testSetCurrentPageBeforePreRender()
  2. 8.9.x core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testSetCurrentPageBeforePreRender()
  3. 10 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testSetCurrentPageBeforePreRender()

@covers ::setCurrentPage @covers ::getCurrentPage

File

core/modules/views/tests/src/Unit/ViewExecutableTest.php, line 659

Class

ViewExecutableTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21ViewExecutable.php/class/ViewExecutable/11.x" title="Represents a view as a whole." class="local">\Drupal\views\ViewExecutable</a> @group views

Namespace

Drupal\Tests\views\Unit

Code

public function testSetCurrentPageBeforePreRender() : void {
    
    /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */
    
    /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */
    [
        $view,
        $display,
    ] = $this->setupBaseViewAndDisplay();
    $view->setCurrentPage(12);
    $this->assertEquals(12, $view->getCurrentPage());
    $this->assertContains('page:12', $view->element['#cache']['keys']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.