function AddModerationConfigActionTest::testWorkflowMustBeContentModeration

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

File

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

Class

AddModerationConfigActionTest
@covers \Drupal\content_moderation\Plugin\ConfigAction\AddModeration @covers \Drupal\content_moderation\Plugin\ConfigAction\AddModerationDeriver @group content_moderation @group Recipe

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.