You are here

public function BlockPageVariantTest::testBuildWithoutMainContent in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest::testBuildWithoutMainContent()
  2. 9 core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest::testBuildWithoutMainContent()

Tests the building of a full page variant with no main content set.

@covers ::build

File

core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php, line 239

Class

BlockPageVariantTest
@coversDefaultClass \Drupal\block\Plugin\DisplayVariant\BlockPageVariant @group block

Namespace

Drupal\Tests\block\Unit\Plugin\DisplayVariant

Code

public function testBuildWithoutMainContent() {
  $display_variant = $this
    ->setUpDisplayVariant();
  $this->blockRepository
    ->expects($this
    ->once())
    ->method('getVisibleBlocksPerRegion')
    ->willReturn([]);
  $expected = [
    '#cache' => [
      'tags' => [
        'config:block_list',
      ],
      'contexts' => [],
      'max-age' => -1,
    ],
    'content' => [
      'system_main' => [],
      'messages' => [
        '#weight' => -1000,
        '#type' => 'status_messages',
        '#include_fallback' => TRUE,
      ],
    ],
  ];
  $this
    ->assertSame($expected, $display_variant
    ->build());
}