You are here

public function ModerationInformationTest::testIsModeratableEntity 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::testIsModeratableEntity()

Test moderatable entity.

@dataProvider providerBoolean @covers ::isModeratableEntity

File

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

Class

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

Namespace

Drupal\Tests\workbench_moderation\Unit

Code

public function testIsModeratableEntity($status) {
  $moderation_information = new ModerationInformation($this
    ->setupModerationEntityManager($status), $this
    ->getUser());
  $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');
  $this
    ->assertEquals($status, $moderation_information
    ->isModeratableEntity($entity
    ->reveal()));
}