function AddModerationConfigActionTest::testAddEntityTypeAndBundle

Tests adding entity types and bundles to a workflow.

File

core/modules/content_moderation/tests/src/Kernel/ConfigAction/AddModerationConfigActionTest.php, line 53

Class

AddModerationConfigActionTest
Tests Add Moderation Config Action.

Namespace

Drupal\Tests\content_moderation\Kernel\ConfigAction

Code

public function testAddEntityTypeAndBundle() : void {
  $this->installEntitySchema('node');
  $this->installConfig('node');
  $this->createContentType([
    'type' => 'a',
  ]);
  $this->createContentType([
    'type' => 'b',
  ]);
  $this->createContentType([
    'type' => 'c',
  ]);
  $this->createVocabulary([
    'vid' => 'tags',
  ]);
  $recipe = $this->createRecipe('workflows.workflow.editorial');
  RecipeRunner::processRecipe($recipe);
  /** @var \Drupal\content_moderation\Plugin\WorkflowType\ContentModerationInterface $plugin */
  $plugin = Workflow::load('editorial')?->getTypePlugin();
  $this->assertSame([
    'a',
    'b',
  ], $plugin->getBundlesForEntityType('node'));
  $this->assertSame([
    'tags',
  ], $plugin->getBundlesForEntityType('taxonomy_term'));
}

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