You are here

public function BlockRepositoryTest::providerBlocksConfig in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/block/tests/src/Unit/BlockRepositoryTest.php \Drupal\Tests\block\Unit\BlockRepositoryTest::providerBlocksConfig()

File

core/modules/block/tests/src/Unit/BlockRepositoryTest.php, line 120
Contains \Drupal\Tests\block\Unit\BlockRepositoryTest.

Class

BlockRepositoryTest
@coversDefaultClass \Drupal\block\BlockRepository @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;
}