function PagerPluginBaseTest::testSetCurrentPage
Same name in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::testSetCurrentPage()
- 8.9.x core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::testSetCurrentPage()
- 11.x core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::testSetCurrentPage()
Tests the setCurrentPage() method.
See also
\Drupal\views\Plugin\views\pager\PagerPluginBase::setCurrentPage()
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ pager/ PagerPluginBaseTest.php, line 103
Class
- PagerPluginBaseTest
- @coversDefaultClass \Drupal\views\Plugin\views\pager\PagerPluginBase @group views
Namespace
Drupal\Tests\views\Unit\Plugin\pagerCode
public function testSetCurrentPage() : void {
$this->pager
->setCurrentPage(2);
$this->assertEquals(2, $this->pager
->getCurrentPage());
// A non numeric number or number below 0 should return 0.
$this->pager
->setCurrentPage('two');
$this->assertEquals(0, $this->pager
->getCurrentPage());
$this->pager
->setCurrentPage(-2);
$this->assertEquals(0, $this->pager
->getCurrentPage());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.