X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fcontent_moderation%2Ftests%2Fsrc%2FKernel%2FContentModerationWorkflowTypeApiTest.php;fp=web%2Fcore%2Fmodules%2Fcontent_moderation%2Ftests%2Fsrc%2FKernel%2FContentModerationWorkflowTypeApiTest.php;h=e10756cf562f3a94f05011da7ef65317c626ac14;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=c2ea8c576d514d106e5ba92f0778ff9e686af831;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php b/web/core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php index c2ea8c576..e10756cf5 100644 --- a/web/core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php +++ b/web/core/modules/content_moderation/tests/src/Kernel/ContentModerationWorkflowTypeApiTest.php @@ -37,9 +37,6 @@ class ContentModerationWorkflowTypeApiTest extends KernelTestBase { protected function setUp() { parent::setUp(); $this->workflow = Workflow::create(['id' => 'test', 'type' => 'content_moderation']); - $this->workflow - ->addState('draft', 'Draft') - ->addState('published', 'Published'); } /** @@ -101,4 +98,26 @@ class ContentModerationWorkflowTypeApiTest extends KernelTestBase { ); } + /** + * @covers ::addEntityTypeAndBundle + * @covers ::removeEntityTypeAndBundle + */ + public function testRemoveEntityTypeAndBundle() { + /** @var \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration $workflow_plugin */ + $workflow_plugin = $this->workflow->getTypePlugin(); + + // There should be no bundles for fake_node to start with. + $this->assertEquals([], $workflow_plugin->getBundlesForEntityType('fake_node')); + // Removing a bundle which is not set on the workflow should not throw an + // error and should still result in none being returned. + $workflow_plugin->removeEntityTypeAndBundle('fake_node', 'fake_page'); + $this->assertEquals([], $workflow_plugin->getBundlesForEntityType('fake_node')); + // Adding a bundle for fake_node should result it in being returned, but + // then removing it will return no bundles for fake_node. + $workflow_plugin->addEntityTypeAndBundle('fake_node', 'fake_page'); + $this->assertEquals(['fake_page'], $workflow_plugin->getBundlesForEntityType('fake_node')); + $workflow_plugin->removeEntityTypeAndBundle('fake_node', 'fake_page'); + $this->assertEquals([], $workflow_plugin->getBundlesForEntityType('fake_node')); + } + }