function LayoutBuilderBlocksTest::testLayoutBuilderChooseBlocksAlter
Same name in other branches
- 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderBlocksTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderBlocksTest::testLayoutBuilderChooseBlocksAlter()
File
-
core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderBlocksTest.php, line 88
Class
- LayoutBuilderBlocksTest
- Tests the Layout Builder UI with blocks.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testLayoutBuilderChooseBlocksAlter() : void {
// See layout_builder_test_plugin_filter_block__layout_builder_alter().
$assert_session = $this->assertSession();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
'administer node display',
'administer node fields',
]));
// From the manage display page, go to manage the layout.
$this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default');
$this->submitForm([
'layout[enabled]' => TRUE,
], 'Save');
$assert_session->linkExists('Manage layout');
$this->clickLink('Manage layout');
// Add a new block.
$this->clickLink('Add block');
// Verify that blocks not modified are present.
$assert_session->linkExists('Powered by Drupal');
$assert_session->linkExists('Default revision');
// Verify that blocks explicitly removed are not present.
$assert_session->linkNotExists('Help');
$assert_session->linkNotExists('Sticky at top of lists');
$assert_session->linkNotExists('Main page content');
$assert_session->linkNotExists('Page title');
$assert_session->linkNotExists('Messages');
$assert_session->linkNotExists('Help');
$assert_session->linkNotExists('Tabs');
$assert_session->linkNotExists('Primary admin actions');
// Verify that Changed block is not present on first section.
$assert_session->linkNotExists('Changed');
// Go back to Manage layout.
$this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default');
$this->clickLink('Manage layout');
// Add a new section.
$this->clickLink('Add section', 1);
$assert_session->linkExists('Two column');
$this->clickLink('Two column');
$assert_session->buttonExists('Add section');
$this->getSession()
->getPage()
->pressButton('Add section');
// Add a new block to second section.
$this->clickLink('Add block', 1);
// Verify that Changed block is present on second section.
$assert_session->linkExists('Changed');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.