You are here

public function ModerationInformationTest::testGetOriginalState in Drupal 8

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

@covers ::getOriginalState

File

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

Class

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

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testGetOriginalState() {
  $entity = EntityTestMulRevPub::create([
    'moderation_state' => 'published',
  ]);
  $entity
    ->save();
  $entity->moderation_state = 'foo';
  $this
    ->assertEquals('published', $this->moderationInformation
    ->getOriginalState($entity)
    ->id());
}