You are here

public function LayoutBuilderNestedFormUiTest::testAddingFormBlocksToOverrides in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderNestedFormUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderNestedFormUiTest::testAddingFormBlocksToOverrides()
  2. 10 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 101

Class

LayoutBuilderNestedFormUiTest
Tests placing blocks containing forms in theLayout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

public function testAddingFormBlocksToOverrides() {
  $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++;
  }
}