You are here

public static function NumberTest::providerTestValidStepOffset in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Utility/NumberTest.php \Drupal\Tests\Component\Utility\NumberTest::providerTestValidStepOffset()

Data provider for \Drupal\Test\Component\Utility\NumberTest::testValidStepOffset().

See also

\Drupal\Test\Component\Utility\NumberTest::testValidStepOffset()

File

core/tests/Drupal/Tests/Component/Utility/NumberTest.php, line 105
Contains \Drupal\Tests\Component\Utility\NumberTest.

Class

NumberTest
Tests number manipulation utilities.

Namespace

Drupal\Tests\Component\Utility

Code

public static function providerTestValidStepOffset() {
  return array(
    // Try obvious fits.
    array(
      11.3,
      10.3,
      1,
      TRUE,
    ),
    array(
      100,
      10,
      50,
      TRUE,
    ),
    array(
      -100,
      90 / 7,
      -10,
      TRUE,
    ),
    array(
      2 / 7 + 5 / 9,
      1 / 7,
      5 / 9,
      TRUE,
    ),
    // Ensure a small offset is still invalid.
    array(
      10.3,
      10.3,
      0.0001,
      FALSE,
    ),
    array(
      1 / 5,
      1 / 7,
      1 / 11,
      FALSE,
    ),
    // Try negative values and offsets.
    array(
      1000,
      10,
      -5,
      FALSE,
    ),
    array(
      -10,
      4,
      0,
      FALSE,
    ),
    array(
      -10,
      4,
      -4,
      FALSE,
    ),
  );
}