function BlockPageVariantTest::testBuildWithoutMainContent

Same name in other branches
  1. 9 core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest::testBuildWithoutMainContent()
  2. 10 core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest::testBuildWithoutMainContent()
  3. 11.x 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());
}

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