function ContentModerationResaveTest::setUp

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationResaveTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationResaveTest::setUp()
  2. 11.x core/modules/content_moderation/tests/src/Kernel/ContentModerationResaveTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationResaveTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/content_moderation/tests/src/Kernel/ContentModerationResaveTest.php, line 58

Class

ContentModerationResaveTest
Tests Content Moderation with entities that get re-saved automatically.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $entity_type_id = 'entity_test_rev';
    $this->installEntitySchema('content_moderation_state');
    $this->installEntitySchema($entity_type_id);
    $workflow = $this->createEditorialWorkflow();
    $this->addEntityTypeAndBundleToWorkflow($workflow, $entity_type_id, $entity_type_id);
    
    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $this->container
        ->get('entity_type.manager');
    $this->contentModerationStateStorage = $entity_type_manager->getStorage('content_moderation_state');
    $this->entityStorage = $entity_type_manager->getStorage($entity_type_id);
    $this->state = $this->container
        ->get('state');
}

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