function ContentModerationWorkflowTypeApiTest::testGetBundlesForEntityType

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

@covers ::getBundlesForEntityType
@covers ::addEntityTypeAndBundle
@covers ::removeEntityTypeAndBundle

File

core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php, line 47

Class

ContentModerationWorkflowTypeApiTest
Tests the API of the ContentModeration workflow type plugin.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testGetBundlesForEntityType() : void {
  /** @var \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration $workflow_plugin */
  $workflow_plugin = $this->workflow
    ->getTypePlugin();
  // The content moderation plugin does not validate the existence of the
  // entity type or bundle.
  $this->assertEquals([], $workflow_plugin->getBundlesForEntityType('fake_node'));
  $workflow_plugin->addEntityTypeAndBundle('fake_node', 'fake_page');
  $this->assertEquals([
    'fake_page',
  ], $workflow_plugin->getBundlesForEntityType('fake_node'));
  $this->assertEquals([], $workflow_plugin->getBundlesForEntityType('fake_block'));
  $workflow_plugin->removeEntityTypeAndBundle('fake_node', 'fake_page');
  $this->assertEquals([], $workflow_plugin->getBundlesForEntityType('fake_node'));
}

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