function BlockRepositoryTest::providerBlocksConfig

Same name and namespace in other branches
  1. 9 core/modules/block/tests/src/Unit/BlockRepositoryTest.php \Drupal\Tests\block\Unit\BlockRepositoryTest::providerBlocksConfig()
  2. 8.9.x 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 115

Class

BlockRepositoryTest
@coversDefaultClass \Drupal\block\BlockRepository[[api-linebreak]] @group block

Namespace

Drupal\Tests\block\Unit

Code

public static 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.