function MigrateLanguageNegotiationSettingsTest::testLanguageTypes

Same name in other branches
  1. 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageTypes()
  2. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageTypes()
  3. 10 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageTypes()

Tests migration of language types variables to language.types.yml.

File

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

Class

MigrateLanguageNegotiationSettingsTest
Tests the migration of language negotiation.

Namespace

Drupal\Tests\language\Kernel\Migrate\d7

Code

public function testLanguageTypes() : void {
    $this->executeMigrations([
        'language',
        'd7_language_negotiation_settings',
        'd7_language_types',
    ]);
    $config = $this->config('language.types');
    $this->assertSame([
        'language_content',
        'language_url',
        'language_interface',
    ], $config->get('all'));
    $this->assertSame([
        'language_content',
        'language_interface',
    ], $config->get('configurable'));
    $this->assertSame([
        'enabled' => [
            'language-interface' => 0,
        ],
    ], $config->get('negotiation.language_content'));
    $this->assertSame([
        'enabled' => [
            'language-url' => 0,
            'language-url-fallback' => 1,
        ],
    ], $config->get('negotiation.language_url'));
    $expected_language_interface = [
        'enabled' => [
            'language-url' => -9,
            'language-user' => -10,
            'language-selected' => -6,
        ],
        'method_weights' => [
            'language-url' => -9,
            'language-session' => -8,
            'language-user' => -10,
            'language-browser' => -7,
            'language-selected' => -6,
        ],
    ];
    $this->assertSame($expected_language_interface, $config->get('negotiation.language_interface'));
}

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