function LayoutBuilderOverridesTest::testDeleteField
Same name in other branches
- 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderOverridesTest::testDeleteField()
Tests deleting a field in-use by an overridden layout.
File
-
core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderOverridesTest.php, line 20
Class
- LayoutBuilderOverridesTest
- Tests the Layout Builder UI.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testDeleteField() : void {
$assert_session = $this->assertSession();
$page = $this->getSession()
->getPage();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
'administer node fields',
]));
// Enable layout builder overrides.
LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')->enableLayoutBuilder()
->setOverridable()
->save();
// Ensure there is a layout override.
$this->drupalGet('node/1/layout');
$page->pressButton('Save layout');
// Delete one of the fields in use.
$this->drupalGet('admin/structure/types/manage/bundle_with_section_field/fields/node.bundle_with_section_field.body/delete');
$page->pressButton('Delete');
// The node should still be accessible.
$this->drupalGet('node/1');
$assert_session->statusCodeEquals(200);
$this->drupalGet('node/1/layout');
$assert_session->statusCodeEquals(200);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.