function LayoutBuilderContentModerationIntegrationTest::setUp

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Functional/LayoutBuilderContentModerationIntegrationTest.php \Drupal\Tests\content_moderation\Functional\LayoutBuilderContentModerationIntegrationTest::setUp()
  2. 10 core/modules/content_moderation/tests/src/Functional/LayoutBuilderContentModerationIntegrationTest.php \Drupal\Tests\content_moderation\Functional\LayoutBuilderContentModerationIntegrationTest::setUp()
  3. 11.x core/modules/content_moderation/tests/src/Functional/LayoutBuilderContentModerationIntegrationTest.php \Drupal\Tests\content_moderation\Functional\LayoutBuilderContentModerationIntegrationTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/content_moderation/tests/src/Functional/LayoutBuilderContentModerationIntegrationTest.php, line 37

Class

LayoutBuilderContentModerationIntegrationTest
Tests Content Moderation's integration with Layout Builder.

Namespace

Drupal\Tests\content_moderation\Functional

Code

protected function setUp() {
    parent::setUp();
    // @todo The Layout Builder UI relies on local tasks; fix in
    //   https://www.drupal.org/project/drupal/issues/2917777.
    $this->drupalPlaceBlock('local_tasks_block');
    // Add a new bundle and add an editorial workflow.
    $this->createContentType([
        'type' => 'bundle_with_section_field',
    ]);
    $workflow = $this->createEditorialWorkflow();
    $workflow->getTypePlugin()
        ->addEntityTypeAndBundle('node', 'bundle_with_section_field');
    $workflow->save();
    // Enable layout overrides.
    LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')->enableLayoutBuilder()
        ->setOverridable()
        ->save();
    $this->drupalLogin($this->drupalCreateUser([
        'configure any layout',
        'edit any bundle_with_section_field content',
        'view bundle_with_section_field revisions',
        'revert bundle_with_section_field revisions',
        'view own unpublished content',
        'view latest version',
        'use editorial transition create_new_draft',
        'use editorial transition publish',
    ]));
}

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