function MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain

Same name in this branch
  1. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
Same name in other branches
  1. 9 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
  2. 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
  3. 10 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
  4. 10 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
  5. 11.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
  6. 11.x core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()

Tests the migration with domain negotiation.

File

core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php, line 91

Class

MigrateLanguageNegotiationSettingsTest
Tests the migration of language negotiation.

Namespace

Drupal\Tests\language\Kernel\Migrate\d7

Code

public function testLanguageNegotiationWithDomain() {
    $this->sourceDatabase
        ->update('variable')
        ->fields([
        'value' => serialize(1),
    ])
        ->condition('name', 'locale_language_negotiation_url_part')
        ->execute();
    $this->executeMigrations([
        'language',
        'd7_language_negotiation_settings',
        'language_prefixes_and_domains',
    ]);
    global $base_url;
    $config = $this->config('language.negotiation');
    $this->assertSame('language', $config->get('session.parameter'));
    $this->assertSame(LanguageNegotiationUrl::CONFIG_DOMAIN, $config->get('url.source'));
    $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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.