LanguageNegotiationFormOverrideTest.php in Zircon Profile 8.0
File
core/modules/config/src/Tests/LanguageNegotiationFormOverrideTest.php
View source
<?php
namespace Drupal\config\Tests;
use Drupal\simpletest\WebTestBase;
class LanguageNegotiationFormOverrideTest extends WebTestBase {
public static $modules = array(
'language',
'locale',
'locale_test',
);
public function testFormWithOverride() {
$this
->drupalLogin($this->rootUser);
$overridden_value_en = 'whatever';
$overridden_value_es = 'loquesea';
$settings['config']['language.negotiation']['url']['prefixes'] = (object) array(
'value' => array(
'en' => $overridden_value_en,
'es' => $overridden_value_es,
),
'required' => TRUE,
);
$this
->writeSettings($settings);
$edit = array(
'predefined_langcode' => 'es',
);
$this
->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
$this
->drupalGet('admin/config/regional/language/detection/url');
$this
->assertText('Path prefix configuration', 'Language-negotiation form found for English.');
$this
->assertNoFieldByName('prefix[en]', $overridden_value_en, 'Language-negotiation config override not found in English.');
$this
->drupalGet($overridden_value_es . '/admin/config/regional/language/detection/url');
$this
->assertText('Path prefix configuration', 'Language-negotiation form found for Spanish using the overridden prefix.');
$this
->assertNoFieldByName('prefix[es]', $overridden_value_es, 'Language-negotiation config override not found in Spanish.');
}
}