You are here

public function TestBase::testRestore in Workbench Moderation to Content Moderation 8.2

Tests that moderation states are properly restored.

File

tests/src/Kernel/Migration/TestBase.php, line 134

Class

TestBase
Tests the save-clear-restore migration flow for a single entity type.

Namespace

Drupal\Tests\wbm2cm\Kernel\Migration

Code

public function testRestore() {
  $expectations = $this
    ->createRevisions();
  $this
    ->testClear($expectations);
  $this
    ->execute($this->storage
    ->getEntityTypeId(), 'restore');
  foreach ($expectations as $vid => $languages) {

    /** @var \Drupal\Core\Entity\ContentEntityInterface $revision */
    $revision = $this->storage
      ->loadRevision($vid);
    foreach ($languages as $language => $expected_state) {
      $this
        ->assertEquals($expected_state, $revision
        ->getTranslation($language)->moderation_state->target_id);
    }
  }
}