You are here

public function MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithNonExistentVariables in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithNonExistentVariables()
  2. 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithNonExistentVariables()

Tests the migration with non-existent variables.

File

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

Class

MigrateLanguageNegotiationSettingsTest
Tests the migration of language negotiation.

Namespace

Drupal\Tests\language\Kernel\Migrate\d7

Code

public function testLanguageNegotiationWithNonExistentVariables() {
  $this->sourceDatabase
    ->delete('variable')
    ->condition('name', [
    'local_language_negotiation_url_part',
    'local_language_negotiation_session_param',
  ], 'IN')
    ->execute();
  $this
    ->executeMigrations([
    'language',
    'd6_language_negotiation_settings',
    'language_prefixes_and_domains',
  ]);
  $config = $this
    ->config('language.negotiation');
  $this
    ->assertSame('language', $config
    ->get('session.parameter'));
  $this
    ->assertSame(LanguageNegotiationUrl::CONFIG_PATH_PREFIX, $config
    ->get('url.source'));
  $this
    ->assertSame('site_default', $config
    ->get('selected_langcode'));
  $expected_prefixes = [
    'en' => '',
    'fr' => 'fr',
    'is' => 'is',
  ];
  $this
    ->assertSame($expected_prefixes, $config
    ->get('url.prefixes'));
}