function ModerationInformationTest::testIsDefaultRevisionPublished

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php \Drupal\Tests\content_moderation\Kernel\ModerationInformationTest::testIsDefaultRevisionPublished()
  2. 10 core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php \Drupal\Tests\content_moderation\Kernel\ModerationInformationTest::testIsDefaultRevisionPublished()
  3. 11.x 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 149

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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.