public function MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithPrefix in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithPrefix()
- 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageNegotiationWithPrefix()
Tests the migration with prefix negotiation.
File
- core/
modules/ language/ tests/ src/ Kernel/ Migrate/ d7/ MigrateLanguageNegotiationSettingsTest.php, line 55
Class
- MigrateLanguageNegotiationSettingsTest
- Tests the migration of language negotiation.
Namespace
Drupal\Tests\language\Kernel\Migrate\d7Code
public function testLanguageNegotiationWithPrefix() {
$this->sourceDatabase
->update('languages')
->fields([
'domain' => '',
])
->execute();
$this
->executeMigrations([
'language',
'd7_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'));
// 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'));
}