public function ModerationInformationTest::testIsModeratedEntity in Drupal 8
Same name and namespace in other branches
- 9 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 87
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
->bundle()
->willReturn('test_bundle');
$this
->assertEquals($expected, $moderation_information
->isModeratedEntity($entity
->reveal()));
}