You are here

protected function ContentModerationWorkflowConfigTest::setUp in Drupal 9

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

Overrides KernelTestBase::setUp

File

core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowConfigTest.php, line 55

Class

ContentModerationWorkflowConfigTest
Tests how Content Moderation handles workflow config changes.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installSchema('node', 'node_access');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('content_moderation_state');
  $this
    ->installConfig([
    'system',
    'content_moderation',
  ]);
  NodeType::create([
    'type' => 'example',
  ])
    ->save();
  $workflow = $this
    ->createEditorialWorkflow();
  $workflow
    ->getTypePlugin()
    ->addState('test1', 'Test one')
    ->addState('test2', 'Test two')
    ->addState('test3', 'Test three')
    ->addEntityTypeAndBundle('node', 'example');
  $workflow
    ->save();
  $this->workflow = $workflow;
  $this
    ->copyConfig($this->container
    ->get('config.storage'), $this->container
    ->get('config.storage.sync'));
}