function AddModerationConfigActionTest::testAddEntityTypeAndBundle

Same name and namespace in other branches
  1. 10 core/modules/content_moderation/tests/src/Kernel/ConfigAction/AddModerationConfigActionTest.php \Drupal\Tests\content_moderation\Kernel\ConfigAction\AddModerationConfigActionTest::testAddEntityTypeAndBundle()

Tests adding entity types and bundles to a workflow.

File

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

Class

AddModerationConfigActionTest
@covers \Drupal\content_moderation\Plugin\ConfigAction\AddModeration[[api-linebreak]] @covers \Drupal\content_moderation\Plugin\ConfigAction\AddModerationDeriver[[api-linebreak]] @group content_moderation @group Recipe

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.