function ContentModerationTestTrait::addEntityTypeAndBundleToWorkflow

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Traits/ContentModerationTestTrait.php \Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait::addEntityTypeAndBundleToWorkflow()
  2. 8.9.x core/modules/content_moderation/tests/src/Traits/ContentModerationTestTrait.php \Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait::addEntityTypeAndBundleToWorkflow()
  3. 10 core/modules/content_moderation/tests/src/Traits/ContentModerationTestTrait.php \Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait::addEntityTypeAndBundleToWorkflow()

Adds an entity type ID / bundle ID to the given workflow.

Parameters

\Drupal\workflows\WorkflowInterface $workflow: A workflow object.

string $entity_type_id: The entity type ID to add.

string $bundle: The bundle ID to add.

11 calls to ContentModerationTestTrait::addEntityTypeAndBundleToWorkflow()
ContentModerationResaveTest::setUp in core/modules/content_moderation/tests/src/Kernel/ContentModerationResaveTest.php
ContentModerationStateTest::testChangingContentLangcode in core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
Tests changing the language of content without adding a translation.
ContentModerationStateTest::testExistingContentModerationStateDataRemoval in core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
Tests removal of content moderation state entities for preexisting content.
ContentModerationStateTest::testModerationWithFieldConfigOverride in core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
Tests moderation when the moderation_state field has a config override.
ContentModerationStateTest::testModerationWithSpecialLanguages in core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
Tests that entities with special languages can be moderated.

... See full list

1 method overrides ContentModerationTestTrait::addEntityTypeAndBundleToWorkflow()
WorkspacesContentModerationStateTest::addEntityTypeAndBundleToWorkflow in core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php
Adds an entity type ID / bundle ID to the given workflow.

File

core/modules/content_moderation/tests/src/Traits/ContentModerationTestTrait.php, line 105

Class

ContentModerationTestTrait
Provides functionality for testing content moderation.

Namespace

Drupal\Tests\content_moderation\Traits

Code

protected function addEntityTypeAndBundleToWorkflow(WorkflowInterface $workflow, $entity_type_id, $bundle) {
    $workflow->getTypePlugin()
        ->addEntityTypeAndBundle($entity_type_id, $bundle);
    $workflow->save();
}

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