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. 10 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 41

Class

ModerationStateFieldItemListTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21content_moderation%21src%21Plugin%21Field%21ModerationStateFieldItemList.php/class/ModerationStateFieldItemList/8.9.x" title="A computed field that provides a content entity&#039;s moderation state." class="local">\Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList</a>

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function setUp() {
    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',
    ])->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();
}

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