public function ContentModerationStateTest::testWorkflowNonConfigBundleDependencies in Drupal 9
Same name and namespace in other branches
- 8 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 618
Class
- ContentModerationStateTest
- Tests links between a content entity and a content_moderation_state entity.
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testWorkflowNonConfigBundleDependencies() {
// 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());
}