You are here

protected function ContentModerationAccessTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/tests/src/Kernel/ContentModerationAccessTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationAccessTest::setUp()
  2. 10 core/modules/content_moderation/tests/src/Kernel/ContentModerationAccessTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationAccessTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/content_moderation/tests/src/Kernel/ContentModerationAccessTest.php, line 40

Class

ContentModerationAccessTest
Tests content moderation access.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('content_moderation_state');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('user');
  $this
    ->installConfig([
    'content_moderation',
    'filter',
  ]);
  $this
    ->installSchema('system', [
    'sequences',
  ]);
  $this
    ->installSchema('node', [
    'node_access',
  ]);

  // Add a moderated node type.
  $node_type = NodeType::create([
    'type' => 'page',
    'label' => 'Page',
  ]);
  $node_type
    ->save();
  $workflow = $this
    ->createEditorialWorkflow();
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'page');
  $workflow
    ->save();
}