You are here

public function LinkManagerTest::getPagerLinksProvider in JSON:API 8

Data provider for testGetPagerLinks.

Return value

array The data for the test method.

File

tests/src/Unit/LinkManager/LinkManagerTest.php, line 97

Class

LinkManagerTest
@coversDefaultClass \Drupal\jsonapi\LinkManager\LinkManager @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\LinkManager

Code

public function getPagerLinksProvider() {
  return [
    [
      1,
      4,
      TRUE,
      8,
      TRUE,
      [
        'first' => [
          'offset' => 0,
          'limit' => 4,
        ],
        'prev' => [
          'offset' => 0,
          'limit' => 4,
        ],
        'next' => [
          'offset' => 5,
          'limit' => 4,
        ],
        'last' => [
          'offset' => 4,
          'limit' => 4,
        ],
      ],
    ],
    [
      6,
      4,
      FALSE,
      4,
      TRUE,
      [
        'first' => [
          'offset' => 0,
          'limit' => 4,
        ],
        'prev' => [
          'offset' => 2,
          'limit' => 4,
        ],
        'next' => NULL,
      ],
    ],
    [
      7,
      4,
      FALSE,
      5,
      FALSE,
      [
        'first' => [
          'offset' => 0,
          'limit' => 4,
        ],
        'prev' => [
          'offset' => 3,
          'limit' => 4,
        ],
        'next' => NULL,
      ],
    ],
    [
      10,
      4,
      FALSE,
      20,
      FALSE,
      [
        'first' => [
          'offset' => 0,
          'limit' => 4,
        ],
        'prev' => [
          'offset' => 6,
          'limit' => 4,
        ],
        'next' => NULL,
      ],
    ],
    [
      5,
      4,
      TRUE,
      30,
      FALSE,
      [
        'first' => [
          'offset' => 0,
          'limit' => 4,
        ],
        'prev' => [
          'offset' => 1,
          'limit' => 4,
        ],
        'next' => [
          'offset' => 9,
          'limit' => 4,
        ],
      ],
    ],
    [
      0,
      4,
      TRUE,
      100,
      TRUE,
      [
        'first' => NULL,
        'prev' => NULL,
        'next' => [
          'offset' => 4,
          'limit' => 4,
        ],
        'last' => [
          'offset' => 96,
          'limit' => 4,
        ],
      ],
    ],
    [
      0,
      1,
      FALSE,
      1,
      FALSE,
      [
        'first' => NULL,
        'prev' => NULL,
        'next' => NULL,
      ],
    ],
    [
      0,
      1,
      FALSE,
      2,
      FALSE,
      [
        'first' => NULL,
        'prev' => NULL,
        'next' => NULL,
      ],
    ],
  ];
}