You are here

public function ModerationInformationTest::testIsModeratedEntityForm in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/ModerationInformationTest.php \Drupal\Tests\workbench_moderation\Unit\ModerationInformationTest::testIsModeratedEntityForm()

Test moderated entity form.

@dataProvider providerBoolean @covers ::isModeratedEntityForm

File

tests/src/Unit/ModerationInformationTest.php, line 121

Class

ModerationInformationTest
@coversDefaultClass \Drupal\workbench_moderation\ModerationInformation @group workbench_moderation

Namespace

Drupal\Tests\workbench_moderation\Unit

Code

public function testIsModeratedEntityForm($status) {
  $entity_type = new ContentEntityType([
    'id' => 'test_entity_type',
    'bundle_entity_type' => 'entity_test_bundle',
  ]);
  $entity = $this
    ->prophesize(ContentEntityInterface::class);
  $entity
    ->getEntityType()
    ->willReturn($entity_type);
  $entity
    ->bundle()
    ->willReturn('test_bundle');
  $form = $this
    ->prophesize(ContentEntityFormInterface::class);
  $form
    ->getEntity()
    ->willReturn($entity);
  $moderation_information = new ModerationInformation($this
    ->setupModerationEntityManager($status), $this
    ->getUser());
  $this
    ->assertEquals($status, $moderation_information
    ->isModeratedEntityForm($form
    ->reveal()));
}