You are here

public function PagerPluginBaseTest::testSetCurrentPage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 100
Contains \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest.

Class

PagerPluginBaseTest
@coversDefaultClass \Drupal\views\Plugin\views\pager\PagerPluginBase @group views

Namespace

Drupal\Tests\views\Unit\Plugin\pager

Code

public function testSetCurrentPage() {
  $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());
}