function ModeratedContentViewTest::setUp

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

Overrides BrowserTestBase::setUp

File

core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php, line 45

Class

ModeratedContentViewTest
Tests moderated content administration page functionality.

Namespace

Drupal\Tests\content_moderation\Functional

Code

public function setUp() : void {
    parent::setUp();
    $this->drupalCreateContentType([
        'type' => 'page',
        'name' => 'Basic page',
    ])
        ->save();
    $this->drupalCreateContentType([
        'type' => 'article',
        'name' => 'Article',
    ])
        ->save();
    $this->drupalCreateContentType([
        'type' => 'unmoderated_type',
        'name' => 'Unmoderated type',
    ])
        ->save();
    $workflow = $this->createEditorialWorkflow();
    $workflow->getTypePlugin()
        ->addEntityTypeAndBundle('node', 'page');
    $workflow->getTypePlugin()
        ->addEntityTypeAndBundle('node', 'article');
    $workflow->save();
    $this->adminUser = $this->drupalCreateUser([
        'access administration pages',
        'view any unpublished content',
        'administer nodes',
        'bypass node access',
    ]);
}

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