You are here

public function MigrateNodeRevisionTest::testNodeRevision in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/Migrate/d6/MigrateNodeRevisionTest.php \Drupal\node\Tests\Migrate\d6\MigrateNodeRevisionTest::testNodeRevision()

Test node revisions migration from Drupal 6 to 8.

File

core/modules/node/src/Tests/Migrate/d6/MigrateNodeRevisionTest.php, line 28
Contains \Drupal\node\Tests\Migrate\d6\MigrateNodeRevisionTest.

Class

MigrateNodeRevisionTest
Node content revisions migration.

Namespace

Drupal\node\Tests\Migrate\d6

Code

public function testNodeRevision() {
  $node = \Drupal::entityManager()
    ->getStorage('node')
    ->loadRevision(2);

  /** @var \Drupal\node\NodeInterface $node */
  $this
    ->assertIdentical('1', $node
    ->id());
  $this
    ->assertIdentical('2', $node
    ->getRevisionId());
  $this
    ->assertIdentical('und', $node->langcode->value);
  $this
    ->assertIdentical('Test title rev 2', $node
    ->getTitle());
  $this
    ->assertIdentical('body test rev 2', $node->body->value);
  $this
    ->assertIdentical('teaser test rev 2', $node->body->summary);
  $this
    ->assertIdentical('2', $node
    ->getRevisionAuthor()
    ->id());
  $this
    ->assertIdentical('modified rev 2', $node->revision_log->value);
  $this
    ->assertIdentical('1390095702', $node
    ->getRevisionCreationTime());
  $node = \Drupal::entityManager()
    ->getStorage('node')
    ->loadRevision(5);
  $this
    ->assertIdentical('1', $node
    ->id());
  $this
    ->assertIdentical('body test rev 3', $node->body->value);
  $this
    ->assertIdentical('1', $node
    ->getRevisionAuthor()
    ->id());
  $this
    ->assertIdentical('modified rev 3', $node->revision_log->value);
  $this
    ->assertIdentical('1390095703', $node
    ->getRevisionCreationTime());
}