function MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain

Same name in this branch
  1. 11.x core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\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. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
  4. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
  5. 10 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()
  6. 10 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithDomain()

Tests the migration with LANGUAGE_NEGOTIATION_DOMAIN.

File

core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageNegotiationSettingsTest.php, line 132

Class

MigrateLanguageNegotiationSettingsTest
Tests the migration of language negotiation and language types.

Namespace

Drupal\Tests\language\Kernel\Migrate\d6

Code

public function testLanguageNegotiationWithDomain() : void {
    $this->sourceDatabase
        ->update('variable')
        ->fields([
        'value' => serialize(3),
    ])
        ->condition('name', 'language_negotiation')
        ->execute();
    $this->executeMigrations([
        'language',
        'd6_language_negotiation_settings',
        'language_prefixes_and_domains',
        'd6_language_types',
    ]);
    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',
        'zu' => 'zu.drupal.org',
    ];
    $this->assertSame($expected_domains, $config->get('url.domains'));
    $config = $this->config('language.types');
    $this->assertSame([
        'language_interface',
        'language_content',
        'language_url',
    ], $config->get('all'));
    $this->assertSame([
        'language_interface',
    ], $config->get('configurable'));
    $this->assertSame([
        'language-interface' => 0,
    ], $config->get('negotiation.language_content.enabled'));
    $this->assertSame([
        'language-url' => 0,
        'language-url-fallback' => 1,
    ], $config->get('negotiation.language_url.enabled'));
    $expected_language_interface = [
        'language-url' => 0,
        'language-selected' => 1,
    ];
    $this->assertSame($expected_language_interface, $config->get('negotiation.language_interface.enabled'));
}

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