function MigrateNodeCompleteTest::assertRevision

Same name in this branch
  1. 11.x core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest::assertRevision()
Same name in other branches
  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()
  3. 8.9.x core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeCompleteTest::assertRevision()
  4. 8.9.x core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest::assertRevision()
  5. 10 core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeCompleteTest::assertRevision()
  6. 10 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest::assertRevision()

Asserts various aspects of a node revision.

@internal

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 102

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) : void {
    
    /** @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']));
}

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