X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fconfig%2Ftests%2Fsrc%2FFunctional%2FLanguageNegotiationFormOverrideTest.php;fp=web%2Fcore%2Fmodules%2Fconfig%2Ftests%2Fsrc%2FFunctional%2FLanguageNegotiationFormOverrideTest.php;h=6c4e1bb3118a51e118ae9077a28c9e253dc198ca;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php b/web/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php new file mode 100644 index 000000000..6c4e1bb31 --- /dev/null +++ b/web/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php @@ -0,0 +1,58 @@ +drupalLogin($this->rootUser); + $overridden_value_en = 'whatever'; + $overridden_value_es = 'loquesea'; + + // Set up an override. + $settings['config']['language.negotiation']['url']['prefixes'] = (object) [ + 'value' => ['en' => $overridden_value_en, 'es' => $overridden_value_es], + 'required' => TRUE, + ]; + $this->writeSettings($settings); + + // Add predefined language. + $edit = [ + 'predefined_langcode' => 'es', + ]; + $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + + // Overridden string for language-negotiation should not exist in the form. + $this->drupalGet('admin/config/regional/language/detection/url'); + + // The language-negotiation form should be found. + $this->assertText('Path prefix configuration', 'Language-negotiation form found for English.'); + + // The English override should not be found. + $this->assertNoFieldByName('prefix[en]', $overridden_value_en, 'Language-negotiation config override not found in English.'); + + // Now check the Spanish version of the page for the same thing. + $this->drupalGet($overridden_value_es . '/admin/config/regional/language/detection/url'); + + // The language-negotiation form should be found. + $this->assertText('Path prefix configuration', 'Language-negotiation form found for Spanish using the overridden prefix.'); + + // The Spanish override should not be found. + $this->assertNoFieldByName('prefix[es]', $overridden_value_es, 'Language-negotiation config override not found in Spanish.'); + + } + +}