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. 8.9.x 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.

@internal

Parameters

int $id: The revision ID.

string $title: The expected title.

int $uid: The revision author ID.

string|null $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
Tests node migration from Drupal 7 to 8.

File

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

Class

MigrateNodeTest
Tests node migration.

Namespace

Drupal\Tests\node\Kernel\Migrate\d7

Code

protected function assertRevision(int $id, string $title, int $uid, ?string $log, int $timestamp) : void {
    $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.