function LayoutBuilderOverridesTest::testOverridesFormAlter
Same name in other branches
- 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderOverridesTest::testOverridesFormAlter()
Tests a custom alter of the overrides form.
File
-
core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderOverridesTest.php, line 145
Class
- LayoutBuilderOverridesTest
- Tests the Layout Builder UI.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testOverridesFormAlter() : void {
$assert_session = $this->assertSession();
$page = $this->getSession()
->getPage();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
'administer node display',
'administer nodes',
]));
$field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field';
// Enable overrides.
$this->drupalGet("{$field_ui_prefix}/display/default");
$this->submitForm([
'layout[enabled]' => TRUE,
], 'Save');
$this->drupalGet("{$field_ui_prefix}/display/default");
$this->submitForm([
'layout[allow_custom]' => TRUE,
], 'Save');
$this->drupalGet('node/1');
// The status checkbox should be checked by default.
$page->clickLink('Layout');
$assert_session->checkboxChecked('status[value]');
$page->pressButton('Save layout');
$assert_session->pageTextContains('The layout override has been saved.');
// Unchecking the status checkbox will unpublish the entity.
$page->clickLink('Layout');
$page->uncheckField('status[value]');
$page->pressButton('Save layout');
$assert_session->statusCodeEquals(403);
$assert_session->pageTextContains('The layout override has been saved.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.