function ViewsModerationStateFilterTest::setUp

Same name in this branch
  1. 11.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
  2. 9 core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Functional\ViewsModerationStateFilterTest::setUp()
  3. 8.9.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
  4. 8.9.x core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Functional\ViewsModerationStateFilterTest::setUp()
  5. 10 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
  6. 10 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 47

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);
    $this->drupalCreateContentType([
        'type' => 'example_a',
    ]);
    $this->drupalCreateContentType([
        'type' => 'example_b',
    ]);
    $this->drupalCreateContentType([
        'type' => 'example_c',
    ]);
    $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.