3 namespace Drupal\config\Tests;
5 use Drupal\simpletest\WebTestBase;
8 * Tests language-negotiation overrides are not on language-negotiation form.
11 * @see \Drupal\Core\Form\ConfigFormBase
13 class LanguageNegotiationFormOverrideTest extends WebTestBase {
15 public static $modules = ['language', 'locale', 'locale_test'];
18 * Tests that overrides do not affect language-negotiation form values.
20 public function testFormWithOverride() {
21 $this->drupalLogin($this->rootUser);
22 $overridden_value_en = 'whatever';
23 $overridden_value_es = 'loquesea';
25 // Set up an override.
26 $settings['config']['language.negotiation']['url']['prefixes'] = (object) [
27 'value' => ['en' => $overridden_value_en, 'es' => $overridden_value_es],
30 $this->writeSettings($settings);
32 // Add predefined language.
34 'predefined_langcode' => 'es',
36 $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
38 // Overridden string for language-negotiation should not exist in the form.
39 $this->drupalGet('admin/config/regional/language/detection/url');
41 // The language-negotiation form should be found.
42 $this->assertText('Path prefix configuration', 'Language-negotiation form found for English.');
44 // The English override should not be found.
45 $this->assertNoFieldByName('prefix[en]', $overridden_value_en, 'Language-negotiation config override not found in English.');
47 // Now check the Spanish version of the page for the same thing.
48 $this->drupalGet($overridden_value_es . '/admin/config/regional/language/detection/url');
50 // The language-negotiation form should be found.
51 $this->assertText('Path prefix configuration', 'Language-negotiation form found for Spanish using the overridden prefix.');
53 // The Spanish override should not be found.
54 $this->assertNoFieldByName('prefix[es]', $overridden_value_es, 'Language-negotiation config override not found in Spanish.');