You are here

protected function MigrateNodeCompleteTest::assertRevision in Drupal 9

Same name in this branch
  1. 9 core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeCompleteTest::assertRevision()
  2. 9 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest::assertRevision()
Same name and namespace in other branches
  1. 8 core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeCompleteTest::assertRevision()

Asserts various aspects of a node revision.

Parameters

array $revision: An array of revision data matching a node_field_revision table row.

array $data: An array of revision data.

1 call to MigrateNodeCompleteTest::assertRevision()
MigrateNodeCompleteTest::testNodeCompleteMigration in core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php
Tests the complete node migration.

File

core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php, line 100

Class

MigrateNodeCompleteTest
Test class for a complete node migration for Drupal 6.

Namespace

Drupal\Tests\node\Kernel\Migrate\d6

Code

protected function assertRevision(array $revision, array $data) {

  /** @var  \Drupal\node\NodeInterface $actual */
  $actual = $this->nodeStorage
    ->loadRevision($revision['vid'])
    ->getTranslation($revision['langcode']);
  $this
    ->assertInstanceOf(NodeInterface::class, $actual);
  $this
    ->assertSame($revision['title'], $actual
    ->getTitle(), sprintf("Title '%s' does not match actual '%s' for revision '%d' langcode '%s'", $revision['title'], $actual
    ->getTitle(), $revision['vid'], $revision['langcode']));
  $this
    ->assertSame($revision['revision_translation_affected'], $actual
    ->get('revision_translation_affected')->value, sprintf("revision_translation_affected '%s' does not match actual '%s' for revision '%d' langcode '%s'", $revision['revision_translation_affected'], $actual
    ->get('revision_translation_affected')->value, $revision['vid'], $revision['langcode']));
  $this
    ->assertSame($data['created'], $actual
    ->getRevisionCreationTime(), sprintf("Creation time '%s' does not match actual '%s' for revision '%d' langcode '%s'", $data['created'], $actual
    ->getRevisionCreationTime(), $revision['vid'], $revision['langcode']));
  $this
    ->assertSame($data['changed'], $actual
    ->getChangedTime(), sprintf("Changed time '%s' does not match actual '%s' for revision '%d' langcode '%s'", $data['changed'], $actual
    ->getChangedTime(), $revision['vid'], $revision['langcode']));
  $this
    ->assertSame($data['log'], $actual
    ->getRevisionLogMessage(), sprintf("Revision log '%s' does not match actual '%s' for revision '%d' langcode '%s'", var_export($data['log'], TRUE), $actual
    ->getRevisionLogMessage(), $revision['vid'], $revision['langcode']));
}