function ModerationInformationTest::testIsModeratedEntity
Same name in other branches
- 8.9.x core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::testIsModeratedEntity()
- 10 core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::testIsModeratedEntity()
- 11.x core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::testIsModeratedEntity()
@dataProvider providerWorkflow @covers ::isModeratedEntity
File
-
core/
modules/ content_moderation/ tests/ src/ Unit/ ModerationInformationTest.php, line 89
Class
- ModerationInformationTest
- @coversDefaultClass \Drupal\content_moderation\ModerationInformation @group content_moderation
Namespace
Drupal\Tests\content_moderation\UnitCode
public function testIsModeratedEntity($workflow, $expected) {
$moderation_information = new ModerationInformation($this->getEntityTypeManager(), $this->setupModerationBundleInfo('test_bundle', $workflow));
$entity_type = new ContentEntityType([
'id' => 'test_entity_type',
'bundle_entity_type' => 'entity_test_bundle',
'handlers' => [
'moderation' => ModerationHandler::class,
],
]);
$entity = $this->prophesize(ContentEntityInterface::class);
$entity->getEntityType()
->willReturn($entity_type);
$entity->getEntityTypeId()
->willReturn($entity_type->id());
$entity->bundle()
->willReturn('test_bundle');
$this->assertEquals($expected, $moderation_information->isModeratedEntity($entity->reveal()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.