You are here

protected function CreateModeratedForwardRevisionTest::setUp in Acquia Content Hub 8.2

Throws

\Exception

Overrides KernelTestBase::setUp

File

tests/src/Kernel/EventSubscriber/ModeratedRevisions/CreateModeratedForwardRevisionTest.php, line 62

Class

CreateModeratedForwardRevisionTest
Test that moderation state is correctly handled in PreEntitySave event.

Namespace

Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\PreEntitySave

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('content_moderation_state');
  $this
    ->installSchema('node', [
    'node_access',
  ]);
  $this
    ->installConfig([
    'system',
    'content_moderation',
    'acquia_contenthub_moderation',
  ]);
  NodeType::create([
    'type' => 'bundle_test',
    'new_revision' => TRUE,
  ])
    ->save();
  $this->workflow = $this
    ->createEditorialWorkflow();
  $this->workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'bundle_test');
  $this->workflow
    ->save();

  /** @var \Drupal\node\NodeInterface $node */
  $this->node = Node::create([
    'type' => 'bundle_test',
    'moderation_state' => 'draft',
    'langcode' => 'en',
    'title' => 'Check forward revisions',
  ]);
}