function MenuTreeParametersTest::providerTestSetMinDepth

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php \Drupal\Tests\Core\Menu\MenuTreeParametersTest::providerTestSetMinDepth()
  2. 10 core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php \Drupal\Tests\Core\Menu\MenuTreeParametersTest::providerTestSetMinDepth()
  3. 11.x core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php \Drupal\Tests\Core\Menu\MenuTreeParametersTest::providerTestSetMinDepth()

Provides test data for testSetMinDepth().

File

core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php, line 20

Class

MenuTreeParametersTest
Tests the menu link tree parameters value object.

Namespace

Drupal\Tests\Core\Menu

Code

public function providerTestSetMinDepth() {
    $data = [];
    // Valid values at the extremes and in the middle.
    $data[] = [
        1,
        1,
    ];
    $data[] = [
        2,
        2,
    ];
    $data[] = [
        9,
        9,
    ];
    // Invalid values are mapped to the closest valid value.
    $data[] = [
        -10000,
        1,
    ];
    $data[] = [
        0,
        1,
    ];
    // … except for those invalid values that reach beyond the maximum depth,
    // because MenuTreeParameters is a value object and hence cannot depend
    // on anything; to know the actual maximum depth, it'd have to depend on the
    // MenuTreeStorage service.
    $data[] = [
        10,
        10,
    ];
    $data[] = [
        100000,
        100000,
    ];
    return $data;
}

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