function PagerPluginBaseTest::providerTestHasMoreRecords

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::providerTestHasMoreRecords()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::providerTestHasMoreRecords()
  3. 10 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 188

Class

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

Namespace

Drupal\Tests\views\Unit\Plugin\pager

Code

public static 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,
        ],
    ];
}

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