You are here

public function PagerPluginBaseTest::providerTestHasMoreRecords in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::providerTestHasMoreRecords()

Provides test data for the hasMoreRecord method test.

See also

self::testHasMoreRecords

File

core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php, line 186
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 providerTestHasMoreRecords() {
  return [
    // No items per page, so there can't be more available records.
    [
      0,
      0,
      0,
      FALSE,
    ],
    [
      0,
      10,
      0,
      FALSE,
    ],
    // The amount of total items equals the items per page, so there is no
    // next page available.
    [
      5,
      5,
      0,
      FALSE,
    ],
    // There is one more item, and we are at the first page.
    [
      5,
      6,
      0,
      TRUE,
    ],
    // Now we are on the second page, which has just a single one left.
    [
      5,
      6,
      1,
      FALSE,
    ],
    // Increase the total items, so we have some available on the third page.
    [
      5,
      12,
      1,
      TRUE,
    ],
  ];
}