function BlockRepositoryTest::providerBlocksConfig

Same name and namespace in other branches
  1. 8.9.x core/modules/block/tests/src/Unit/BlockRepositoryTest.php \Drupal\Tests\block\Unit\BlockRepositoryTest::providerBlocksConfig()
  2. 10 core/modules/block/tests/src/Unit/BlockRepositoryTest.php \Drupal\Tests\block\Unit\BlockRepositoryTest::providerBlocksConfig()
  3. 11.x core/modules/block/tests/src/Unit/BlockRepositoryTest.php \Drupal\Tests\block\Unit\BlockRepositoryTest::providerBlocksConfig()

File

core/modules/block/tests/src/Unit/BlockRepositoryTest.php, line 113

Class

BlockRepositoryTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21block%21src%21BlockRepository.php/class/BlockRepository/9" title="Provides a repository for Block config entities." class="local">\Drupal\block\BlockRepository</a> @group block

Namespace

Drupal\Tests\block\Unit

Code

public function providerBlocksConfig() {
    $blocks_config = [
        'block1' => [
            AccessResult::allowed(),
            'top',
            0,
        ],
        // Test a block without access.
'block2' => [
            AccessResult::forbidden(),
            'bottom',
            0,
        ],
        // Test some blocks in the same region with specific weight.
'block4' => [
            AccessResult::allowed(),
            'bottom',
            5,
        ],
        'block3' => [
            AccessResult::allowed(),
            'bottom',
            5,
        ],
        'block5' => [
            AccessResult::allowed(),
            'bottom',
            -5,
        ],
    ];
    $test_cases = [];
    $test_cases[] = [
        $blocks_config,
        [
            'top' => [
                'block1',
            ],
            'center' => [],
            'bottom' => [
                'block5',
                'block3',
                'block4',
            ],
        ],
    ];
    return $test_cases;
}

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