function ModerationRevisionRevertTest::setUp

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

Overrides BrowserTestBase::setUp

File

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

Class

ModerationRevisionRevertTest
Test revision revert.

Namespace

Drupal\Tests\content_moderation\Functional

Code

public function setUp() : void {
    parent::setUp();
    $moderated_bundle = $this->createContentType([
        'type' => 'moderated_bundle',
    ]);
    $moderated_bundle->save();
    $workflow = $this->createEditorialWorkflow();
    $workflow->getTypePlugin()
        ->addEntityTypeAndBundle('node', 'moderated_bundle');
    $workflow->save();
    
    /** @var \Drupal\Core\Routing\RouteBuilderInterface $router_builder */
    $router_builder = $this->container
        ->get('router.builder');
    $router_builder->rebuildIfNeeded();
    $admin = $this->drupalCreateUser([
        'access content overview',
        'administer nodes',
        'bypass node access',
        'view all revisions',
        'use editorial transition create_new_draft',
        'use editorial transition publish',
    ]);
    $this->drupalLogin($admin);
}

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