Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / migrate_drupal_ui / tests / src / Functional / d6 / MigrateUpgrade6Test.php
index 71eebe823b92b0815660a2f81a05415de854858a..54ea5747ad52e8c699c925c2dd7451b1599f73be 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\migrate_drupal_ui\Functional\d6;
 
+use Drupal\node\Entity\Node;
 use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase;
 use Drupal\user\Entity\User;
 
@@ -22,6 +23,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
   public static $modules = [
     'language',
     'content_translation',
+    'config_translation',
     'migrate_drupal_ui',
     'telephone',
     'aggregator',
@@ -29,6 +31,8 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
     'forum',
     'statistics',
     'migration_provider_test',
+    // Required for translation migrations.
+    'migrate_drupal_multilingual',
   ];
 
   /**
@@ -56,21 +60,21 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
       'block' => 35,
       'block_content' => 2,
       'block_content_type' => 1,
-      'comment' => 6,
+      'comment' => 8,
       // The 'standard' profile provides the 'comment' comment type, and the
       // migration creates 12 comment types, one per node type.
       'comment_type' => 13,
       'contact_form' => 5,
       'configurable_language' => 5,
       'editor' => 2,
-      'field_config' => 84,
-      'field_storage_config' => 58,
-      'file' => 8,
+      'field_config' => 90,
+      'field_storage_config' => 64,
+      'file' => 7,
       'filter_format' => 7,
       'image_style' => 5,
-      'language_content_settings' => 2,
+      'language_content_settings' => 10,
       'migration' => 105,
-      'node' => 17,
+      'node' => 18,
       // The 'book' module provides the 'book' node type, and the migration
       // creates 12 node types.
       'node_type' => 13,
@@ -82,15 +86,15 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
       'menu' => 8,
       'taxonomy_term' => 8,
       'taxonomy_vocabulary' => 7,
-      'tour' => 4,
+      'tour' => 5,
       'user' => 7,
       'user_role' => 6,
-      'menu_link_content' => 5,
+      'menu_link_content' => 10,
       'view' => 16,
       'date_format' => 11,
       'entity_form_display' => 29,
       'entity_form_mode' => 1,
-      'entity_view_display' => 53,
+      'entity_view_display' => 55,
       'entity_view_mode' => 14,
       'base_field_override' => 38,
     ];
@@ -102,12 +106,12 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
   protected function getEntityCountsIncremental() {
     $counts = $this->getEntityCounts();
     $counts['block_content'] = 3;
-    $counts['comment'] = 7;
-    $counts['entity_view_display'] = 53;
+    $counts['comment'] = 9;
+    $counts['entity_view_display'] = 55;
     $counts['entity_view_mode'] = 14;
-    $counts['file'] = 9;
-    $counts['menu_link_content'] = 6;
-    $counts['node'] = 18;
+    $counts['file'] = 8;
+    $counts['menu_link_content'] = 11;
+    $counts['node'] = 19;
     $counts['taxonomy_term'] = 9;
     $counts['user'] = 8;
     $counts['view'] = 16;
@@ -131,6 +135,12 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
       'filefield',
       'filter',
       'forum',
+      'i18n',
+      'i18nblocks',
+      'i18ncck',
+      'i18nmenu',
+      'i18nprofile',
+      'i18nstrings',
       'i18ntaxonomy',
       'imagecache',
       'imagefield',
@@ -157,8 +167,6 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
       'date_api',
       'date_timezone',
       'event',
-      'i18n',
-      'i18nstrings',
       'imageapi',
       'number',
       'php',
@@ -172,13 +180,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
    */
   protected function getMissingPaths() {
     return [
-      'i18nblocks',
-      'i18ncck',
       'i18ncontent',
-      'i18nmenu',
-      // This module is in the missing path list because it is installed on the
-      // source site but it is not installed on the destination site.
-      'i18nprofile',
     ];
   }
 
@@ -192,6 +194,26 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
     $user = User::load(2);
     $user->passRaw = 'john.doe_pass';
     $this->drupalLogin($user);
+    $this->assertFollowUpMigrationResults();
+  }
+
+  /**
+   * Tests that follow-up migrations have been run successfully.
+   */
+  protected function assertFollowUpMigrationResults() {
+    $node = Node::load(10);
+    $this->assertSame('12', $node->get('field_reference')->target_id);
+    $this->assertSame('12', $node->get('field_reference_2')->target_id);
+    $translation = $node->getTranslation('fr');
+    $this->assertSame('12', $translation->get('field_reference')->target_id);
+    $this->assertSame('12', $translation->get('field_reference_2')->target_id);
+
+    $node = Node::load(12)->getTranslation('en');
+    $this->assertSame('10', $node->get('field_reference')->target_id);
+    $this->assertSame('10', $node->get('field_reference_2')->target_id);
+    $translation = $node->getTranslation('fr');
+    $this->assertSame('10', $translation->get('field_reference')->target_id);
+    $this->assertSame('10', $translation->get('field_reference_2')->target_id);
   }
 
 }