You are here

public function LayoutDefaultTest::testBuild in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php \Drupal\Tests\Core\Layout\LayoutDefaultTest::testBuild()

@covers ::build @dataProvider providerTestBuild

File

core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php, line 19

Class

LayoutDefaultTest
@coversDefaultClass \Drupal\Core\Layout\LayoutDefault @group Layout

Namespace

Drupal\Tests\Core\Layout

Code

public function testBuild($regions, $expected) {
  $definition = new LayoutDefinition([
    'theme_hook' => 'layout',
    'library' => 'core/drupal',
    'regions' => [
      'left' => [
        'label' => 'Left',
      ],
      'right' => [
        'label' => 'Right',
      ],
    ],
  ]);
  $expected += [
    '#settings' => [
      'label' => '',
    ],
    '#layout' => $definition,
    '#theme' => 'layout',
    '#attached' => [
      'library' => [
        'core/drupal',
      ],
    ],
  ];
  $layout = new LayoutDefault([], '', $definition);
  $this
    ->assertSame($expected, $layout
    ->build($regions));
}