diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php index d33aa9f043..131219a710 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php @@ -2,8 +2,6 @@ namespace Drupal\Tests\node\Kernel\Migrate\d6; -use Drupal\node\NodeInterface; - /** * Node content revisions migration. * @@ -12,13 +10,6 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase { /** - * The entity storage for node. - * - * @var \Drupal\Core\Entity\EntityStorageInterface - */ - protected $nodeStorage; - - /** * {@inheritdoc} */ public static $modules = ['language', 'content_translation', 'menu_ui']; @@ -29,41 +20,13 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase { protected function setUp() { parent::setUp(); $this->executeMigrations(['d6_node', 'd6_node_revision']); - $this->nodeStorage = $this->container->get('entity_type.manager') - ->getStorage('node'); - } - - /** - * Asserts various aspects of a node revision. - * - * @param int $id - * The revision ID. - * @param string $langcode - * The revision language. - * @param string $title - * The expected title. - * @param string $log - * The revision log message. - * @param int $timestamp - * The revision's time stamp. - */ - protected function assertRevision($id, $langcode, $title, $log, $timestamp) { - /* @var \Drupal\node\NodeInterface $revision */ - $revision = $this->nodeStorage->loadRevision($id) - ->getTranslation($langcode); - $this->assertInstanceOf(NodeInterface::class, $revision); - $this->assertSame($title, $revision->getTitle()); - $this->assertSame($log, $revision->revision_log->value); - $this->assertIdentical($timestamp, $revision->getRevisionCreationTime()); } /** * Test node revisions migration from Drupal 6 to 8. */ public function testNodeRevision() { - $node = \Drupal::entityTypeManager() - ->getStorage('node') - ->loadRevision(2001); + $node = \Drupal::entityTypeManager()->getStorage('node')->loadRevision(2001); /** @var \Drupal\node\NodeInterface $node */ $this->assertIdentical('1', $node->id()); $this->assertIdentical('2001', $node->getRevisionId()); @@ -81,37 +44,6 @@ public function testNodeRevision() { $this->assertIdentical('1', $node->getRevisionUser()->id()); $this->assertIdentical('modified rev 3', $node->revision_log->value); $this->assertIdentical('1390095703', $node->getRevisionCreationTime()); - - $this->assertRevision(1, 'und', 'Test title', NULL, '1420861423'); - $this->assertRevision(2001, 'und', 'Test title rev 2', 'modified rev 2', '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 3', 'modified rev 3', '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 2', 'modified rev 2', '1390095702'); - $this->assertRevision(2002, 'en', 'John Smith - EN', NULL, '1534014650'); - - // Translation revisions are not migrated. - $ids = [14, 16, 23, 2003]; - foreach ($ids as $id) { - $revision = $this->nodeStorage->loadRevision($id); - $this->assertNull($revision); - } } } diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php deleted file mode 100644 index 3f66a8b578..0000000000 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php +++ /dev/null @@ -1,136 +0,0 @@ -fileMigrationSetup(); - - $this->installEntitySchema('node'); - $this->installEntitySchema('comment'); - $this->installEntitySchema('taxonomy_term'); - $this->installSchema('comment', ['comment_entity_statistics']); - $this->installSchema('node', ['node_access']); - - $this->migrateUsers(); - $this->migrateFields(); - $this->executeMigrations([ - 'language', - 'd7_language_content_settings', - 'd7_comment_field', - 'd7_comment_field_instance', - 'd7_node', - 'd7_node_translation', - 'd7_node_revision', - ]); - $this->nodeStorage = $this->container->get('entity_type.manager') - ->getStorage('node'); - } - - /** - * {@inheritdoc} - */ - protected function getFileMigrationInfo() { - return [ - 'path' => 'public://sites/default/files/cube.jpeg', - 'size' => '3620', - 'base_path' => 'public://', - 'plugin_id' => 'd7_file', - ]; - } - - /** - * Asserts various aspects of a node revision. - * - * @param int $id - * The revision ID. - * @param string $langcode - * The revision language. - * @param string $title - * The expected title. - * @param string $log - * The revision log message. - * @param int $timestamp - * The revision's time stamp. - */ - protected function assertRevision($id, $langcode, $title, $log, $timestamp) { - /* @var \Drupal\node\NodeInterface $revision */ - $revision = $this->nodeStorage->loadRevision($id) - ->getTranslation($langcode); - $this->assertInstanceOf(NodeInterface::class, $revision); - $this->assertSame($title, $revision->getTitle()); - $this->assertSame($log, $revision->revision_log->value); - $this->assertIdentical($timestamp, $revision->getRevisionCreationTime()); - } - - /** - * Tests the migration of node revisions with translated nodes. - */ - public function testNodeRevisions() { - $this->assertRevision(1, 'en', 'An English Node', NULL, '1441032132'); - $this->assertRevision(2, 'en', 'The thing about Deep Space 9 (1st rev)', 'DS9 1st rev', '1564543588'); - $this->assertRevision(4, 'is', 'is - The thing about Firefly (1st rev)', 'is - Firefly 1st rev', '1478755274'); - $this->assertRevision(6, 'en', 'Comments are closed :-(', NULL, '1504715414'); - $this->assertRevision(7, 'en', 'Comments are open :-)', NULL, '1504715432'); - $this->assertRevision(8, 'en', 'The number 47', NULL, '1552126247'); - $this->assertRevision(11, 'en', 'The thing about Deep Space 9', 'DS9 2nd rev', '1564543637'); - $this->assertRevision(13, 'is', 'is - The thing about Firefly', 'is - Firefly 2nd rev', '1564543810'); - $this->assertRevision(14, 'is', 'is - The thing about Deep Space 9', 'is - DS9 2nd rev', '1564543706'); - $this->assertRevision(15, 'en', 'en - The thing about Firefly', 'Firefly 2nd rev', '1564543929'); - $this->assertRevision(16, 'en', 'The number 47', NULL, '1552126296'); - $this->assertRevision(17, 'en', 'The number 47', NULL, '1552126363'); - - // Translation revisions are not migrated. - $ids = [3, 5, 9, 10, 12, 18]; - foreach ($ids as $id) { - $revision = $this->nodeStorage->loadRevision($id); - $this->assertNull($revision); - } - } - -}