function ContentModerationWorkflowTypeApiTest::testAddEntityTypeAndBundle
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationWorkflowTypeApiTest::testAddEntityTypeAndBundle()
- 10 core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationWorkflowTypeApiTest::testAddEntityTypeAndBundle()
- 11.x core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationWorkflowTypeApiTest::testAddEntityTypeAndBundle()
@covers ::addEntityTypeAndBundle
File
-
core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationWorkflowTypeApiTest.php, line 81
Class
- ContentModerationWorkflowTypeApiTest
- Tests the API of the ContentModeration workflow type plugin.
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testAddEntityTypeAndBundle() {
/** @var \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration $workflow_plugin */
$workflow_plugin = $this->workflow
->getTypePlugin();
// The bundles are intentionally added in reverse alphabetical order.
$workflow_plugin->addEntityTypeAndBundle('fake_node', 'fake_page');
$workflow_plugin->addEntityTypeAndBundle('fake_node', 'fake_article');
// Add another entity type that comes alphabetically before 'fake_node'.
$workflow_plugin->addEntityTypeAndBundle('fake_block', 'fake_custom');
// The entity type keys and bundle values should be sorted alphabetically.
// The bundle array index should not reflect the order in which they are
// added.
$this->assertSame([
'fake_block' => [
'fake_custom',
],
'fake_node' => [
'fake_article',
'fake_page',
],
], $workflow_plugin->getConfiguration()['entity_types']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.