function MigrateNodeTest::assertRevision

Same name in other branches
  1. 9 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTest::assertRevision()
  2. 10 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTest::assertRevision()
  3. 11.x core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTest::assertRevision()

Asserts various aspects of a node revision.

Parameters

int $id: The revision ID.

string $title: The expected title.

int $uid: The revision author ID.

string $log: The revision log message.

int $timestamp: The revision's time stamp.

1 call to MigrateNodeTest::assertRevision()
MigrateNodeTest::testNode in core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php
Test node migration from Drupal 7 to 8.

File

core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php, line 137

Class

MigrateNodeTest
Tests node migration.

Namespace

Drupal\Tests\node\Kernel\Migrate\d7

Code

protected function assertRevision($id, $title, $uid, $log, $timestamp) {
    $revision = \Drupal::entityTypeManager()->getStorage('node')
        ->loadRevision($id);
    $this->assertInstanceOf(NodeInterface::class, $revision);
    $this->assertEquals($title, $revision->getTitle());
    $this->assertEquals($uid, $revision->getRevisionUser()
        ->id());
    $this->assertEquals($log, $revision->revision_log->value);
    $this->assertEquals($timestamp, $revision->getRevisionCreationTime());
}

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