function AddModerationConfigActionTest::testWorkflowMustBeContentModeration

Tests that the workflow must be of type Content Moderation.

File

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

Class

AddModerationConfigActionTest
Tests Add Moderation Config Action.

Namespace

Drupal\Tests\content_moderation\Kernel\ConfigAction

Code

public function testWorkflowMustBeContentModeration() : void {
  $this->enableModules([
    'workflows',
    'workflow_type_test',
  ]);
  $workflow = Workflow::create([
    'id' => 'test',
    'label' => 'Test workflow',
    'type' => 'workflow_type_test',
  ]);
  $workflow->save();
  $recipe = $this->createRecipe($workflow->getConfigDependencyName());
  $this->expectException(ConfigActionException::class);
  $this->expectExceptionMessage("The add_moderation:addNodeTypes config action only works with Content Moderation workflows.");
  RecipeRunner::processRecipe($recipe);
}

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