function ModerationInformationTest::testGetWorkflowForEntity
Same name in other branches
- 8.9.x core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::testGetWorkflowForEntity()
- 10 core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::testGetWorkflowForEntity()
- 11.x core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::testGetWorkflowForEntity()
@dataProvider providerWorkflow @covers ::getWorkflowForEntity
File
-
core/
modules/ content_moderation/ tests/ src/ Unit/ ModerationInformationTest.php, line 109
Class
- ModerationInformationTest
- @coversDefaultClass \Drupal\content_moderation\ModerationInformation @group content_moderation
Namespace
Drupal\Tests\content_moderation\UnitCode
public function testGetWorkflowForEntity($workflow) {
$entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
if ($workflow) {
$workflow_entity = $this->prophesize(WorkflowInterface::class)
->reveal();
$workflow_storage = $this->prophesize(EntityStorageInterface::class);
$workflow_storage->load('workflow')
->willReturn($workflow_entity)
->shouldBeCalled();
$entity_type_manager->getStorage('workflow')
->willReturn($workflow_storage->reveal());
}
else {
$workflow_entity = NULL;
}
$moderation_information = new ModerationInformation($entity_type_manager->reveal(), $this->setupModerationBundleInfo('test_bundle', $workflow));
$entity = $this->prophesize(ContentEntityInterface::class);
$entity->getEntityTypeId()
->willReturn('test_entity_type');
$entity->bundle()
->willReturn('test_bundle');
$this->assertEquals($workflow_entity, $moderation_information->getWorkflowForEntity($entity->reveal()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.