function ModerationStateFieldItemListTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateFieldItemListTest::setUp()
  2. 8.9.x core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateFieldItemListTest::setUp()
  3. 11.x 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 46

Class

ModerationStateFieldItemListTest
@coversDefaultClass \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList[[api-linebreak]]

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('content_moderation');
  NodeType::create([
    'type' => 'unmoderated',
    'name' => 'Unmoderated',
  ])->save();
  $node_type = NodeType::create([
    'type' => 'example',
    'name' => '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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.