function ContentModerationWorkflowTypeApiTest::testAppliesToEntityTypeAndBundle

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationWorkflowTypeApiTest::testAppliesToEntityTypeAndBundle()
  2. 8.9.x core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationWorkflowTypeApiTest::testAppliesToEntityTypeAndBundle()
  3. 10 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 67

Class

ContentModerationWorkflowTypeApiTest
Tests the API of the ContentModeration workflow type plugin.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testAppliesToEntityTypeAndBundle() : 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->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'));
}

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