From a42433ef912f612255a8a6cc85f4d6ef303b560c Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Wed, 15 Aug 2018 02:47:40 +0100
Subject: [PATCH] Issue #2985784 by maxocub, heddn, masipila: No static mapping
 found in d7_language_content_settings migration

---
 .../d7_language_content_settings.yml          |  3 +++
 .../d7/MigrateLanguageContentSettingsTest.php | 23 ++++++++++++++++---
 .../migrate_drupal/tests/fixtures/drupal7.php |  4 ----
 3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/core/modules/language/migrations/d7_language_content_settings.yml b/core/modules/language/migrations/d7_language_content_settings.yml
index ba170a489a97..9428f42d4dfd 100644
--- a/core/modules/language/migrations/d7_language_content_settings.yml
+++ b/core/modules/language/migrations/d7_language_content_settings.yml
@@ -20,6 +20,8 @@ process:
         0: NULL
         1: 'current_interface'
         2: 'current_interface'
+        4: 'und'
+      default_value: NULL
     -
       plugin: skip_on_empty
       method: row
@@ -38,6 +40,7 @@ process:
       0: NULL
       1: false
       2: true
+      4: true
 destination:
   plugin: entity:language_content_settings
   content_translation_update_definitions:
diff --git a/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentSettingsTest.php b/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentSettingsTest.php
index fdba37073e4f..e584467c9217 100644
--- a/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentSettingsTest.php
+++ b/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentSettingsTest.php
@@ -34,9 +34,9 @@ protected function setUp() {
   public function testLanguageContent() {
     // Assert that a translatable content is still translatable.
     $config = $this->config('language.content_settings.node.blog');
-    $this->assertIdentical($config->get('target_entity_type_id'), 'node');
-    $this->assertIdentical($config->get('target_bundle'), 'blog');
-    $this->assertIdentical($config->get('default_langcode'), 'current_interface');
+    $this->assertSame($config->get('target_entity_type_id'), 'node');
+    $this->assertSame($config->get('target_bundle'), 'blog');
+    $this->assertSame($config->get('default_langcode'), 'current_interface');
     $this->assertFalse($config->get('language_alterable'));
     $this->assertTrue($config->get('third_party_settings.content_translation.enabled'));
 
@@ -46,6 +46,23 @@ public function testLanguageContent() {
     $this->assertFalse($config->isLanguageAlterable());
     $this->assertSame($config->getDefaultLangcode(), 'site_default');
 
+    // Make sure there's no migration exceptions.
+    $messages = $this->migration->getIdMap()->getMessageIterator()->fetchAll();
+    $this->assertEmpty($messages);
+
+    // Assert that a content type translatable with entity_translation is still
+    // translatable.
+    $config = $this->config('language.content_settings.node.test_content_type');
+    $this->assertTrue($config->get('third_party_settings.content_translation.enabled'));
+    $this->assertSame($config->get('default_langcode'), 'und');
+
+    // Assert that a content type without a 'language_content_type' variable is
+    // not translatable
+    $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'book');
+    $this->assertTrue($config->isDefaultConfiguration());
+    $this->assertFalse($config->isLanguageAlterable());
+    $this->assertSame($config->getDefaultLangcode(), 'site_default');
+
   }
 
 }
diff --git a/core/modules/migrate_drupal/tests/fixtures/drupal7.php b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
index 3624a4a92fba..1d6d1d33a5e3 100644
--- a/core/modules/migrate_drupal/tests/fixtures/drupal7.php
+++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
@@ -49585,10 +49585,6 @@
   'name' => 'language_content_type_blog',
   'value' => 's:1:"2";',
 ))
-->values(array(
-  'name' => 'language_content_type_book',
-  'value' => 's:1:"0";',
-))
 ->values(array(
   'name' => 'language_content_type_forum',
   'value' => 's:1:"0";',
-- 
GitLab