You are here

public function BlockPageVariantTest::testBuildWithoutMainContent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 244
Contains \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest.

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',
      ],
    ],
  ];
  $this
    ->assertSame($expected, $display_variant
    ->build());
}