protected function ParagraphsTestBaseTrait::createEditorialWorkflow

Creates a workflow entity.

Parameters

string $bundle: The node bundle.

3 calls to ParagraphsTestBaseTrait::createEditorialWorkflow()
MultilingualBehaviorTest::testMoveModeratedTranslatedNestedParagraphToLibrary in paragraphs/modules/paragraphs_library/tests/src/Functional/MultilingualBehaviorTest.php
Tests converting moderated translated nested paragraph into library.
ParagraphsContentModerationTest::setUp in paragraphs/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsContentModerationTest.php
ParagraphsContentModerationTranslationsTest::setUp in paragraphs/tests/src/Functional/WidgetStable/ParagraphsContentModerationTranslationsTest.php

File

paragraphs/tests/src/FunctionalJavascript/ParagraphsTestBaseTrait.php, line 239

Class

ParagraphsTestBaseTrait
Test trait for Paragraphs JS tests.

Namespace

Drupal\Tests\paragraphs\FunctionalJavascript

Code

protected function createEditorialWorkflow($bundle) {
  if (!isset($this->workflow)) {
    $this->workflow = Workflow::create([
      'type' => 'content_moderation',
      'id' => $this
        ->randomMachineName(),
      'label' => 'Editorial',
      'type_settings' => [
        'states' => [
          'archived' => [
            'label' => 'Archived',
            'weight' => 5,
            'published' => FALSE,
            'default_revision' => TRUE,
          ],
          'draft' => [
            'label' => 'Draft',
            'published' => FALSE,
            'default_revision' => FALSE,
            'weight' => -5,
          ],
          'published' => [
            'label' => 'Published',
            'published' => TRUE,
            'default_revision' => TRUE,
            'weight' => 0,
          ],
        ],
        'transitions' => [
          'archive' => [
            'label' => 'Archive',
            'from' => [
              'published',
            ],
            'to' => 'archived',
            'weight' => 2,
          ],
          'archived_draft' => [
            'label' => 'Restore to Draft',
            'from' => [
              'archived',
            ],
            'to' => 'draft',
            'weight' => 3,
          ],
          'archived_published' => [
            'label' => 'Restore',
            'from' => [
              'archived',
            ],
            'to' => 'published',
            'weight' => 4,
          ],
          'create_new_draft' => [
            'label' => 'Create New Draft',
            'to' => 'draft',
            'weight' => 0,
            'from' => [
              'draft',
              'published',
            ],
          ],
          'publish' => [
            'label' => 'Publish',
            'to' => 'published',
            'weight' => 1,
            'from' => [
              'draft',
              'published',
            ],
          ],
        ],
      ],
    ]);
  }
  $this->workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('node', $bundle);
  $this->workflow
    ->save();
}