function BlockValidationTest::providerMenuBlockLevelAndDepth

Data provider for ::testMenuBlockLevelAndDepth().

File

core/modules/block/tests/src/Kernel/BlockValidationTest.php, line 186

Class

BlockValidationTest
Tests validation of block entities.

Namespace

Drupal\Tests\block\Kernel

Code

public static function providerMenuBlockLevelAndDepth() : iterable {
    (yield 'OK: entire tree from first level' => [
        0,
        NULL,
        [],
    ]);
    (yield 'OK: entire tree from third level' => [
        2,
        NULL,
        [],
    ]);
    (yield 'OK: first three levels' => [
        0,
        3,
        [],
    ]);
    (yield 'INVALID: level is less than 0' => [
        -2,
        NULL,
        [
            'settings.level' => 'This value should be between <em class="placeholder">0</em> and <em class="placeholder">9</em>.',
        ],
    ]);
    (yield 'INVALID: level is greater than 9' => [
        11,
        NULL,
        [
            'settings.level' => 'This value should be between <em class="placeholder">0</em> and <em class="placeholder">9</em>.',
        ],
    ]);
    (yield 'INVALID: depth too high' => [
        0,
        12,
        [
            'settings.depth' => 'This value should be between <em class="placeholder">1</em> and <em class="placeholder">9</em>.',
        ],
    ]);
    (yield 'INVALID: depth too low' => [
        0,
        0,
        [
            'settings.depth' => 'This value should be between <em class="placeholder">1</em> and <em class="placeholder">9</em>.',
        ],
    ]);
    (yield 'INVALID: start at third level, depth too high' => [
        2,
        9,
        [
            'settings.depth' => 'This value should be between <em class="placeholder">1</em> and <em class="placeholder">7</em>.',
        ],
    ]);
    (yield 'OK: deepest level only' => [
        9,
        1,
        [],
    ]);
    (yield 'INVALID: start at deepest level, depth too high' => [
        9,
        2,
        [
            'settings.depth' => 'This value should be between <em class="placeholder">1</em> and <em class="placeholder">1</em>.',
        ],
    ]);
}

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