function ViewsModerationStateFilterTest::setUp

Same name in this branch
  1. 9 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
Same name and namespace in other branches
  1. 8.9.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
  2. 8.9.x core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Functional\ViewsModerationStateFilterTest::setUp()
  3. 10 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
  4. 10 core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Functional\ViewsModerationStateFilterTest::setUp()
  5. 11.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
  6. 11.x core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Functional\ViewsModerationStateFilterTest::setUp()

Overrides ViewTestBase::setUp

File

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

Class

ViewsModerationStateFilterTest
Tests the views 'moderation_state_filter' filter plugin.

Namespace

Drupal\Tests\content_moderation\Functional

Code

protected function setUp($import_test_views = TRUE, $modules = []) : void {
    parent::setUp(FALSE, $modules);
    NodeType::create([
        'type' => 'example_a',
    ])->save();
    NodeType::create([
        'type' => 'example_b',
    ])->save();
    NodeType::create([
        'type' => 'example_c',
    ])->save();
    $this->createEditorialWorkflow();
    $new_workflow = Workflow::create([
        'type' => 'content_moderation',
        'id' => 'new_workflow',
        'label' => 'New workflow',
    ]);
    $new_workflow->getTypePlugin()
        ->addState('bar', 'Bar');
    $new_workflow->getTypePlugin()
        ->addEntityTypeAndBundle('node', 'example_c');
    $new_workflow->save();
    $this->drupalLogin($this->drupalCreateUser([
        'administer workflows',
        'administer views',
    ]));
    $this->container
        ->get('module_installer')
        ->install([
        'content_moderation_test_views',
    ]);
    $new_workflow->getTypePlugin()
        ->removeEntityTypeAndBundle('node', 'example_c');
    $new_workflow->save();
}

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