function ContentModerationStateTest::testWorkflowNonConfigBundleDependencies

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::testWorkflowNonConfigBundleDependencies()
  2. 8.9.x core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::testWorkflowNonConfigBundleDependencies()
  3. 10 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::testWorkflowNonConfigBundleDependencies()

Tests the content moderation workflow dependencies for non-config bundles.

1 method overrides ContentModerationStateTest::testWorkflowNonConfigBundleDependencies()
WorkspacesContentModerationStateTest::testWorkflowNonConfigBundleDependencies in core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php
Tests the content moderation workflow dependencies for non-config bundles.

File

core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php, line 644

Class

ContentModerationStateTest
Tests links between a content entity and a content_moderation_state entity.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testWorkflowNonConfigBundleDependencies() : void {
    // Create a bundle not based on any particular configuration.
    entity_test_create_bundle('test_bundle');
    $workflow = $this->createEditorialWorkflow();
    $workflow->getTypePlugin()
        ->addEntityTypeAndBundle('entity_test', 'test_bundle');
    $workflow->save();
    // Ensure the bundle is correctly added to the workflow.
    $this->assertEquals([
        'module' => [
            'content_moderation',
            'entity_test',
        ],
    ], $workflow->getDependencies());
    $this->assertEquals([
        'test_bundle',
    ], $workflow->getTypePlugin()
        ->getBundlesForEntityType('entity_test'));
    // Delete the test bundle to ensure the workflow entity responds
    // appropriately.
    entity_test_delete_bundle('test_bundle');
    $workflow = Workflow::load('editorial');
    $this->assertEquals([], $workflow->getTypePlugin()
        ->getBundlesForEntityType('entity_test'));
    $this->assertEquals([
        'module' => [
            'content_moderation',
        ],
    ], $workflow->getDependencies());
}

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