function LayoutBuilderNestedFormUiTest::testAddingFormBlocksToOverrides

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

Tests blocks containing forms can be successfully saved editing overrides.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderNestedFormUiTest.php, line 104

Class

LayoutBuilderNestedFormUiTest
Tests placing blocks containing forms in theLayout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

public function testAddingFormBlocksToOverrides() : void {
    $this->drupalLogin($this->drupalCreateUser([
        'configure any layout',
        'administer node display',
    ]));
    // From the manage display page, enable Layout Builder.
    $field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field';
    $this->drupalGet("{$field_ui_prefix}/display/default");
    $this->submitForm([
        'layout[enabled]' => TRUE,
    ], 'Save');
    $this->submitForm([
        'layout[allow_custom]' => TRUE,
    ], 'Save');
    $expected_save_message = 'The layout override has been saved.';
    $nid = 1;
    foreach (static::FORM_BLOCK_LABELS as $label) {
        $this->addFormBlock($label, "node/{$nid}", $expected_save_message);
        $nid++;
    }
}

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