You are here

protected function ModerationStateFieldItemListTest::setUp in Drupal 9

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

Overrides KernelTestBase::setUp

File

core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php, line 43

Class

ModerationStateFieldItemListTest
@coversDefaultClass \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installSchema('node', 'node_access');
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('content_moderation_state');
  $this
    ->installConfig('content_moderation');
  NodeType::create([
    'type' => 'unmoderated',
  ])
    ->save();
  $node_type = NodeType::create([
    'type' => 'example',
  ]);
  $node_type
    ->save();
  $workflow = $this
    ->createEditorialWorkflow();
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'example');
  $workflow
    ->save();
  $this->testNode = Node::create([
    'type' => 'example',
    'title' => 'Test title',
  ]);
  $this->testNode
    ->save();
  \Drupal::entityTypeManager()
    ->getStorage('node')
    ->resetCache();
  $this->testNode = Node::load($this->testNode
    ->id());
  ConfigurableLanguage::createFromLangcode('de')
    ->save();
}