LayoutBuilderQuickEditTest.php

Same filename in this branch
  1. 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php
Same filename and directory in other branches
  1. 9 core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php
  2. 9 core/modules/quickedit/tests/src/Functional/LayoutBuilderQuickEditTest.php

Namespace

Drupal\Tests\layout_builder\Functional

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderQuickEditTest.php

View source
<?php

namespace Drupal\Tests\layout_builder\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests Layout Builder integration with Quick Edit.
 *
 * @group layout_builder
 */
class LayoutBuilderQuickEditTest extends BrowserTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'layout_builder',
    'node',
    'quickedit',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';
  
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    // Create two nodes.
    $this->createContentType([
      'type' => 'bundle_with_section_field',
      'name' => 'Bundle with section field',
    ]);
    $this->createNode([
      'type' => 'bundle_with_section_field',
    ]);
  }
  
  /**
   * Tests Quick Edit integration with a block from a different entity type.
   */
  public function testPlaceFieldBlockFromDifferentEntityType() {
    $page = $this->getSession()
      ->getPage();
    $this->drupalLogin($this->drupalCreateUser([
      'configure any layout',
      'administer node display',
      'access in-place editing',
    ]));
    // From the manage display page, go to manage the layout.
    $this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default');
    $this->drupalPostForm(NULL, [
      'layout[enabled]' => TRUE,
    ], 'Save');
    $this->drupalPostForm(NULL, [
      'layout[allow_custom]' => TRUE,
    ], 'Save');
    // Place a field block for a user entity field.
    $this->drupalGet('node/1/layout');
    $page->clickLink('Add block');
    $page->clickLink('Name');
    $page->pressButton('Add block');
    $page->pressButton('Save layout');
    $this->drupalGet('node/1');
    $this->assertSession()
      ->statusCodeEquals(200);
  }

}

Classes

Title Deprecated Summary
LayoutBuilderQuickEditTest Tests Layout Builder integration with Quick Edit.

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