function LayoutBuilderTest::assertCorrectLayouts

Same name in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::assertCorrectLayouts()
  2. 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::assertCorrectLayouts()
  3. 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::assertCorrectLayouts()

Asserts that the correct layouts are available.

@internal

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 761

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

protected function assertCorrectLayouts() : void {
    $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}");
    }
}

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