You are here

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

@covers ::getOriginalState

File

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

Class

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

Namespace

Drupal\Tests\content_moderation\Kernel

Code

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