You are here

public function ModerationInformationTest::testIsDefaultRevisionPublished in Drupal 9

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

@covers ::isDefaultRevisionPublished @dataProvider isDefaultRevisionPublishedTestCases

File

core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php, line 85

Class

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

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testIsDefaultRevisionPublished($initial_state, $final_state, $initial_is_default_published, $final_is_default_published) {
  $entity = EntityTestMulRevPub::create([
    'moderation_state' => $initial_state,
  ]);
  $entity
    ->save();
  $this
    ->assertEquals($initial_is_default_published, $this->moderationInformation
    ->isDefaultRevisionPublished($entity));
  $entity->moderation_state = $final_state;
  $entity
    ->save();
  $this
    ->assertEquals($final_is_default_published, $this->moderationInformation
    ->isDefaultRevisionPublished($entity));
}