You are here

public function ModerationInformationTest::testShouldModerateEntities in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\content_moderation\Unit\ModerationInformationTest::testShouldModerateEntities()

@dataProvider providerWorkflow @covers ::shouldModerateEntitiesOfBundle

File

core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php, line 132

Class

ModerationInformationTest
@coversDefaultClass \Drupal\content_moderation\ModerationInformation @group content_moderation

Namespace

Drupal\Tests\content_moderation\Unit

Code

public function testShouldModerateEntities($workflow, $expected) {
  $entity_type = new ContentEntityType([
    'id' => 'test_entity_type',
    'bundle_entity_type' => 'entity_test_bundle',
    'handlers' => [
      'moderation' => ModerationHandler::class,
    ],
  ]);
  $moderation_information = new ModerationInformation($this
    ->getEntityTypeManager(), $this
    ->setupModerationBundleInfo('test_bundle', $workflow));
  $this
    ->assertEquals($expected, $moderation_information
    ->shouldModerateEntitiesOfBundle($entity_type, 'test_bundle'));
}