function MigrateNodeRevisionTest::testNodeRevision
Same name in other branches
- 9 core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeRevisionTest::testNodeRevision()
- 10 core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeRevisionTest::testNodeRevision()
- 11.x core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeRevisionTest::testNodeRevision()
Test node revisions migration from Drupal 6 to 8.
File
-
core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d6/ MigrateNodeRevisionTest.php, line 63
Class
- MigrateNodeRevisionTest
- Node content revisions migration.
Namespace
Drupal\Tests\node\Kernel\Migrate\d6Code
public function testNodeRevision() {
$node = \Drupal::entityTypeManager()->getStorage('node')
->loadRevision(2001);
/** @var \Drupal\node\NodeInterface $node */
$this->assertIdentical('1', $node->id());
$this->assertIdentical('2001', $node->getRevisionId());
$this->assertIdentical('und', $node->langcode->value);
$this->assertIdentical('Test title rev 3', $node->getTitle());
$this->assertIdentical('body test rev 3', $node->body->value);
$this->assertIdentical('teaser test rev 3', $node->body->summary);
$this->assertIdentical('2', $node->getRevisionUser()
->id());
$this->assertIdentical('modified rev 3', $node->revision_log->value);
$this->assertIdentical('1420861423', $node->getRevisionCreationTime());
$this->assertRevision(1, 'und', 'Test title', NULL, '1390095702');
$this->assertRevision(3, 'und', 'Test title rev 3', NULL, '1420718386');
$this->assertRevision(4, 'und', 'Test page title rev 4', NULL, '1390095701');
$this->assertRevision(5, 'und', 'Test title rev 2', 'modified rev 2', '1390095703');
$this->assertRevision(6, 'und', 'Node 4', NULL, '1390095701');
$this->assertRevision(7, 'und', 'Node 5', NULL, '1390095701');
$this->assertRevision(8, 'und', 'Node 6', NULL, '1390095701');
$this->assertRevision(9, 'und', 'Node 7', NULL, '1390095701');
$this->assertRevision(10, 'und', 'Node 8', NULL, '1390095701');
$this->assertRevision(11, 'und', 'Node 9', NULL, '1390095701');
$this->assertRevision(12, 'und', 'Once upon a time', NULL, '1444671588');
$this->assertRevision(13, 'en', 'The Real McCoy', NULL, '1444238808');
$this->assertRevision(15, 'zu', 'Abantu zulu', NULL, '1444238808');
$this->assertRevision(17, 'und', 'United Federation of Planets', NULL, '1493066668');
$this->assertRevision(18, 'und', 'Klingon Empire', NULL, '1493066677');
$this->assertRevision(19, 'und', 'Romulan Empire', NULL, '1493066684');
$this->assertRevision(20, 'und', 'Ferengi Commerce Authority', NULL, '1493066693');
$this->assertRevision(21, 'und', 'Ambassador Sarek', NULL, '1494966544');
$this->assertRevision(22, 'und', 'New Forum Topic', NULL, '1501955771');
$this->assertRevision(2001, 'und', 'Test title rev 3', 'modified rev 3', '1420861423');
$this->assertRevision(2002, 'en', 'John Smith - EN', NULL, '1534014650');
// Test that the revision translations are not migrated and there should not
// be a revision with id of 2003.
$ids = [
2,
14,
16,
23,
2003,
];
foreach ($ids as $id) {
$this->assertNull($this->nodeStorage
->loadRevision($id));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.