function NumberTest::providerTestValidStepOffset

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Utility/NumberTest.php \Drupal\Tests\Component\Utility\NumberTest::providerTestValidStepOffset()
  2. 10 core/tests/Drupal/Tests/Component/Utility/NumberTest.php \Drupal\Tests\Component\Utility\NumberTest::providerTestValidStepOffset()
  3. 11.x core/tests/Drupal/Tests/Component/Utility/NumberTest.php \Drupal\Tests\Component\Utility\NumberTest::providerTestValidStepOffset()

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

See also

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

File

core/tests/Drupal/Tests/Component/Utility/NumberTest.php, line 100

Class

NumberTest
Tests number manipulation utilities.

Namespace

Drupal\Tests\Component\Utility

Code

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

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