You are here

public function ControllerBaseTest::pageGenerationData in MongoDB 8.2

Data provider for testPageGeneration().

Coding standards are ignored for the data list for the sake of readability.

See also

\Drupal\Tests\mongodb_watchdog\Unit\ControllerBaseTest::testPageGeneration()

File

modules/mongodb_watchdog/tests/src/Unit/ControllerBaseTest.php, line 40

Class

ControllerBaseTest
Test the ControllerBase mechanisms.

Namespace

Drupal\Tests\mongodb_watchdog\Unit

Code

public function pageGenerationData() {

  // One partial available page.
  $one = static::ITEMS_PER_PAGE;

  // Part of one page.
  $partial = (int) floor($one * 0.6);

  // More than one available page.
  $oneplus = $one + $partial;

  // Exactly two pages.
  $two = (int) ($one * 2);
  $twoplus = $two + $partial;
  $expectations = [
    // @codingStandardsIgnoreStart
    // page, count, result
    [
      -1,
      0,
      0,
    ],
    [
      -1,
      $partial,
      0,
    ],
    [
      -1,
      $one,
      0,
    ],
    [
      -1,
      $oneplus,
      0,
    ],
    [
      -1,
      $two,
      0,
    ],
    [
      0,
      0,
      0,
    ],
    [
      0,
      $partial,
      0,
    ],
    [
      0,
      $one,
      0,
    ],
    [
      0,
      $oneplus,
      0,
    ],
    [
      0,
      $two,
      0,
    ],
    [
      1,
      0,
      0,
    ],
    [
      1,
      $partial,
      0,
    ],
    [
      1,
      $one,
      0,
    ],
    [
      1,
      $oneplus,
      1,
    ],
    [
      1,
      $two,
      1,
    ],
    [
      2,
      0,
      0,
    ],
    [
      2,
      $partial,
      0,
    ],
    [
      2,
      $one,
      0,
    ],
    [
      2,
      $oneplus,
      1,
    ],
    [
      2,
      $two,
      1,
    ],
    [
      2,
      $twoplus,
      2,
    ],
  ];
  return $expectations;
}