You are here

protected function LayoutBuilderTest::assertCorrectLayouts in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::assertCorrectLayouts()
  2. 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::assertCorrectLayouts()

Asserts that the correct layouts are available.

1 call to LayoutBuilderTest::assertCorrectLayouts()
LayoutBuilderTest::testLayoutBuilderUi in core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php, line 1427

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

protected function assertCorrectLayouts() {
  $assert_session = $this
    ->assertSession();

  // Ensure the layouts provided by layout_builder are available.
  $expected_layouts_hrefs = [
    'layout_builder/configure/section/overrides/node.1/0/layout_onecol',
    'layout_builder/configure/section/overrides/node.1/0/layout_twocol_section',
    'layout_builder/configure/section/overrides/node.1/0/layout_threecol_section',
    'layout_builder/configure/section/overrides/node.1/0/layout_fourcol_section',
  ];
  foreach ($expected_layouts_hrefs as $expected_layouts_href) {
    $assert_session
      ->linkByHrefExists($expected_layouts_href);
  }

  // Ensure the layout_discovery module's layouts were removed.
  $unexpected_layouts = [
    'twocol',
    'twocol_bricks',
    'threecol_25_50_25',
    'threecol_33_34_33',
  ];
  foreach ($unexpected_layouts as $unexpected_layout) {
    $assert_session
      ->linkByHrefNotExists("layout_builder/add/section/overrides/node.1/0/{$unexpected_layout}");
    $assert_session
      ->linkByHrefNotExists("layout_builder/configure/section/overrides/node.1/0/{$unexpected_layout}");
  }
}