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 / d7 / MigrateUpgrade7Test.php
index 385a4e58040a3d95acefd61a9572674ba4be0a2e..b1718011f0917e6e1097288c7df2d6a85461ec4c 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\migrate_drupal_ui\Functional\d7;
 
+use Drupal\node\Entity\Node;
 use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase;
 use Drupal\user\Entity\User;
 
@@ -22,14 +23,18 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
   public static $modules = [
     'file',
     'language',
+    'config_translation',
     'content_translation',
     'migrate_drupal_ui',
     'telephone',
     'aggregator',
     'book',
     'forum',
+    'rdf',
     'statistics',
     'migration_provider_test',
+    // Required for translation migrations.
+    'migrate_drupal_multilingual',
   ];
 
   /**
@@ -57,24 +62,25 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
       'block' => 25,
       'block_content' => 1,
       'block_content_type' => 1,
-      'comment' => 1,
+      'comment' => 3,
       // The 'standard' profile provides the 'comment' comment type, and the
       // migration creates 6 comment types, one per node type.
       'comment_type' => 7,
-      // Module 'language' comes with 'en', 'und', 'zxx'. Migration adds 'is'.
-      'configurable_language' => 4,
+      // Module 'language' comes with 'en', 'und', 'zxx'. Migration adds 'is'
+      // and 'fr'.
+      'configurable_language' => 5,
       'contact_form' => 3,
       'editor' => 2,
-      'field_config' => 63,
-      'field_storage_config' => 46,
+      'field_config' => 67,
+      'field_storage_config' => 50,
       'file' => 3,
       'filter_format' => 7,
       'image_style' => 6,
-      'language_content_settings' => 2,
+      'language_content_settings' => 6,
       'migration' => 73,
       'node' => 5,
       'node_type' => 6,
-      'rdf_mapping' => 7,
+      'rdf_mapping' => 8,
       'search_page' => 2,
       'shortcut' => 6,
       'shortcut_set' => 2,
@@ -82,10 +88,10 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
       'menu' => 6,
       'taxonomy_term' => 18,
       'taxonomy_vocabulary' => 4,
-      'tour' => 4,
+      'tour' => 5,
       'user' => 4,
       'user_role' => 3,
-      'menu_link_content' => 8,
+      'menu_link_content' => 12,
       'view' => 16,
       'date_format' => 11,
       'entity_form_display' => 17,
@@ -102,9 +108,9 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
   protected function getEntityCountsIncremental() {
     $counts = $this->getEntityCounts();
     $counts['block_content'] = 2;
-    $counts['comment'] = 2;
+    $counts['comment'] = 4;
     $counts['file'] = 4;
-    $counts['menu_link_content'] = 9;
+    $counts['menu_link_content'] = 13;
     $counts['node'] = 6;
     $counts['taxonomy_term'] = 19;
     $counts['user'] = 5;
@@ -118,6 +124,8 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
     return [
       'aggregator',
       'block',
+      'book',
+      'color',
       'comment',
       'contact',
       'date',
@@ -129,6 +137,7 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
       'file',
       'filter',
       'forum',
+      'i18n_variable',
       'image',
       'language',
       'link',
@@ -140,6 +149,7 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
       'options',
       'path',
       'phone',
+      'rdf',
       'search',
       'shortcut',
       'statistics',
@@ -169,9 +179,10 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
    */
   protected function getMissingPaths() {
     return [
-      'book',
-      'color',
-      'rdf',
+      'i18n',
+      'variable',
+      'variable_realm',
+      'variable_store',
       // These modules are in the missing path list because they are installed
       // on the source site but they are not installed on the destination site.
       'syslog',
@@ -190,6 +201,27 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
     $user = User::load(2);
     $user->passRaw = 'a password';
     $this->drupalLogin($user);
+    $this->assertFollowUpMigrationResults();
+  }
+
+  /**
+   * Tests that follow-up migrations have been run successfully.
+   */
+  protected function assertFollowUpMigrationResults() {
+    $node = Node::load(2);
+    $this->assertSame('4', $node->get('field_reference')->target_id);
+    $this->assertSame('4', $node->get('field_reference_2')->target_id);
+    $translation = $node->getTranslation('is');
+    $this->assertSame('4', $translation->get('field_reference')->target_id);
+    $this->assertSame('4', $translation->get('field_reference_2')->target_id);
+
+    $node = Node::load(4);
+    $this->assertSame('2', $node->get('field_reference')->target_id);
+    $this->assertSame('2', $node->get('field_reference_2')->target_id);
+    $translation = $node->getTranslation('en');
+    $this->assertSame('2', $translation->get('field_reference')->target_id);
+    $this->assertSame('2', $translation->get('field_reference_2')->target_id);
+
   }
 
 }