You are here

public function LayoutBuilderTest::testFormAlter in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testFormAlter()
  2. 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testFormAlter()

Tests that hook_form_alter() has access to the Layout Builder info.

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php, line 965

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testFormAlter() {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'configure any layout',
    'administer node display',
    'administer node fields',
  ]));
  $field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field';
  $this
    ->drupalGet("{$field_ui_prefix}/display/default");
  $page
    ->checkField('layout[enabled]');
  $page
    ->pressButton('Save');
  $page
    ->clickLink('Manage layout');
  $page
    ->clickLink('Add block');
  $page
    ->clickLink('Powered by Drupal');
  $assert_session
    ->pageTextContains('Layout Builder Storage: node.bundle_with_section_field.default');
  $assert_session
    ->pageTextContains('Layout Builder Section: layout_onecol');
  $assert_session
    ->pageTextContains('Layout Builder Component: system_powered_by_block');
}