You are here

public function ModerationStateEntityTest::testModerationStateProperties in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/ModerationStateEntityTest.php \Drupal\Tests\workbench_moderation\Kernel\ModerationStateEntityTest::testModerationStateProperties()

Verify moderation state methods based on entity properties.

@covers ::isPublishedState @covers ::isDefaultRevisionState

@dataProvider moderationStateProvider

File

tests/src/Kernel/ModerationStateEntityTest.php, line 39

Class

ModerationStateEntityTest
Class ModerationStateEntityTest.

Namespace

Drupal\Tests\workbench_moderation\Kernel

Code

public function testModerationStateProperties($published, $default_revision, $is_published, $is_default) {
  $moderation_state_id = $this
    ->randomMachineName();
  $moderation_state = ModerationState::create([
    'id' => $moderation_state_id,
    'label' => $this
      ->randomString(),
    'published' => $published,
    'default_revision' => $default_revision,
  ]);
  $moderation_state
    ->save();
  $moderation_state = ModerationState::load($moderation_state_id);
  $this
    ->assertEquals($is_published, $moderation_state
    ->isPublishedState());
  $this
    ->assertEquals($is_default, $moderation_state
    ->isDefaultRevisionState());
}