function LayoutSectionTest::testLayoutDeletingField

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

Tests that deleting a field removes it from the layout.

File

core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php, line 247

Class

LayoutSectionTest
Tests the rendering of a layout section field.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testLayoutDeletingField() : void {
    $assert_session = $this->assertSession();
    $this->drupalGet('/admin/structure/types/manage/bundle_with_section_field/display/default/layout');
    $assert_session->statusCodeEquals(200);
    $assert_session->elementExists('css', '.field--name-body');
    // Delete the field from both bundles.
    $this->drupalGet('/admin/structure/types/manage/bundle_without_section_field/fields/node.bundle_without_section_field.body/delete');
    $this->submitForm([], 'Delete');
    $this->drupalGet('/admin/structure/types/manage/bundle_with_section_field/display/default/layout');
    $assert_session->statusCodeEquals(200);
    $assert_session->elementExists('css', '.field--name-body');
    $this->drupalGet('/admin/structure/types/manage/bundle_with_section_field/fields/node.bundle_with_section_field.body/delete');
    $this->submitForm([], 'Delete');
    $this->drupalGet('/admin/structure/types/manage/bundle_with_section_field/display/default/layout');
    $assert_session->statusCodeEquals(200);
    $assert_session->elementNotExists('css', '.field--name-body');
}

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