You are here

protected function ViewsModerationStateFilterTest::setUp in Drupal 10

Same name in this branch
  1. 10 core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Functional\ViewsModerationStateFilterTest::setUp()
  2. 10 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 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
  2. 9 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()

File

core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php, line 44

Class

ViewsModerationStateFilterTest
Tests the views 'moderation_state_filter' filter plugin.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp(FALSE);
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('content_moderation_state');
  $this
    ->installEntitySchema('entity_test_no_bundle');
  $this
    ->installSchema('node', 'node_access');
  $this
    ->installConfig('content_moderation');
  $node_type = NodeType::create([
    'type' => 'example',
  ]);
  $node_type
    ->save();
  $node_type = NodeType::create([
    'type' => 'another_example',
  ]);
  $node_type
    ->save();
  $node_type = NodeType::create([
    'type' => 'example_non_moderated',
  ]);
  $node_type
    ->save();
  $workflow = $this
    ->createEditorialWorkflow();
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'example');
  $workflow
    ->save();

  // Install the test views after moderation has been enabled on the example
  // bundle, so the moderation_state field exists.
  $this
    ->installConfig('content_moderation_test_views');
  ConfigurableLanguage::createFromLangcode('fr')
    ->save();
}