Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / language / tests / src / Kernel / Migrate / d7 / MigrateLanguageNegotiationSettingsTest.php
index fe6296cc40e7253c6043217d87f3e97230033fb8..cd1a21835eed7827d50f98682a743932c5fb6ec9 100644 (file)
@@ -53,6 +53,10 @@ class MigrateLanguageNegotiationSettingsTest extends MigrateDrupal7TestBase {
    * Tests the migration with prefix negotiation.
    */
   public function testLanguageNegotiationWithPrefix() {
+    $this->sourceDatabase->update('languages')
+      ->fields(['domain' => ''])
+      ->execute();
+
     $this->executeMigrations([
       'language',
       'd7_language_negotiation_settings',
@@ -65,9 +69,20 @@ class MigrateLanguageNegotiationSettingsTest extends MigrateDrupal7TestBase {
     $this->assertSame('site_default', $config->get('selected_langcode'));
     $expected_prefixes = [
       'en' => '',
+      'fr' => 'fr',
       'is' => 'is',
     ];
     $this->assertSame($expected_prefixes, $config->get('url.prefixes'));
+
+    // If prefix negotiation is used, make sure that no domains are migrated.
+    // Otherwise there will be validation errors when trying to save URL
+    // language detection configuration from the UI.
+    $expected_domains = [
+      'en' => '',
+      'fr' => '',
+      'is' => '',
+    ];
+    $this->assertSame($expected_domains, $config->get('url.domains'));
   }
 
   /**
@@ -92,6 +107,7 @@ class MigrateLanguageNegotiationSettingsTest extends MigrateDrupal7TestBase {
     $this->assertSame('site_default', $config->get('selected_langcode'));
     $expected_domains = [
       'en' => parse_url($base_url, PHP_URL_HOST),
+      'fr' => 'fr.drupal.org',
       'is' => 'is.drupal.org',
     ];
     $this->assertSame($expected_domains, $config->get('url.domains'));
@@ -117,6 +133,7 @@ class MigrateLanguageNegotiationSettingsTest extends MigrateDrupal7TestBase {
     $this->assertSame('site_default', $config->get('selected_langcode'));
     $expected_prefixes = [
       'en' => '',
+      'fr' => 'fr',
       'is' => 'is',
     ];
     $this->assertSame($expected_prefixes, $config->get('url.prefixes'));