You are here

public function ContentModerationWorkflowTypeApiTest::testAppliesToEntityTypeAndBundle in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationWorkflowTypeApiTest::testAppliesToEntityTypeAndBundle()

@covers ::appliesToEntityTypeAndBundle @covers ::addEntityTypeAndBundle @covers ::removeEntityTypeAndBundle

File

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

Class

ContentModerationWorkflowTypeApiTest
Tests the API of the ContentModeration workflow type plugin.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testAppliesToEntityTypeAndBundle() {

  /** @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
    ->assertFalse($workflow_plugin
    ->appliesToEntityTypeAndBundle('fake_node', 'fake_page'));
  $workflow_plugin
    ->addEntityTypeAndBundle('fake_node', 'fake_page');
  $this
    ->assertTrue($workflow_plugin
    ->appliesToEntityTypeAndBundle('fake_node', 'fake_page'));
  $this
    ->assertFalse($workflow_plugin
    ->appliesToEntityTypeAndBundle('fake_block', 'fake_custom'));
  $workflow_plugin
    ->removeEntityTypeAndBundle('fake_node', 'fake_page');
  $this
    ->assertFalse($workflow_plugin
    ->appliesToEntityTypeAndBundle('fake_node', 'fake_page'));
}