public function ContentModerationWorkflowTypeApiTest::testAppliesToEntityTypeAndBundle in Drupal 8
Same name and namespace in other branches
- 9 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\KernelCode
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'));
}