class LanguageNegotiationFormOverrideTest
Same name and namespace in other branches
- 11.x core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php \Drupal\Tests\config\Functional\LanguageNegotiationFormOverrideTest
- 10 core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php \Drupal\Tests\config\Functional\LanguageNegotiationFormOverrideTest
- 8.9.x core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php \Drupal\Tests\config\Functional\LanguageNegotiationFormOverrideTest
Tests language-negotiation overrides are not on language-negotiation form.
@group config
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\config\Functional\LanguageNegotiationFormOverrideTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of LanguageNegotiationFormOverrideTest
See also
\Drupal\Core\Form\ConfigFormBase
File
-
core/
modules/ config/ tests/ src/ Functional/ LanguageNegotiationFormOverrideTest.php, line 13
Namespace
Drupal\Tests\config\FunctionalView source
class LanguageNegotiationFormOverrideTest extends BrowserTestBase {
protected static $modules = [
'language',
'locale',
'locale_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests that overrides do not affect language-negotiation form values.
*/
public function testFormWithOverride() {
$this->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->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, '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->assertSession()
->pageTextContains('Path prefix configuration');
// The English override should not be found.
$this->assertSession()
->fieldValueNotEquals('prefix[en]', $overridden_value_en);
// 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->assertSession()
->pageTextContains('Path prefix configuration');
// The Spanish override should not be found.
$this->assertSession()
->fieldValueNotEquals('prefix[es]', $overridden_value_es);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.