function ConfigTranslationUiTest::testAccountSettingsConfigurationTranslation
Same name in other branches
- 9 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testAccountSettingsConfigurationTranslation()
- 8.9.x core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testAccountSettingsConfigurationTranslation()
- 11.x core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testAccountSettingsConfigurationTranslation()
Tests the account settings translation interface.
This is the only special case so far where we have multiple configuration names involved building up one configuration translation form. Test that the translations are saved for all configuration names properly.
File
-
core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationUiTest.php, line 27
Class
- ConfigTranslationUiTest
- Translate settings and entities to various languages.
Namespace
Drupal\Tests\config_translation\FunctionalCode
public function testAccountSettingsConfigurationTranslation() : void {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/config/people/accounts');
$this->assertSession()
->linkExists('Translate account settings');
$this->drupalGet('admin/config/people/accounts/translate');
$this->assertSession()
->linkExists('Translate account settings');
$this->assertSession()
->linkByHrefExists('admin/config/people/accounts/translate/fr/add');
// Update account settings fields for French.
$edit = [
'translation[config_names][user.settings][anonymous]' => 'Anonyme',
'translation[config_names][user.mail][status_blocked][subject]' => 'Testing, your account is blocked.',
'translation[config_names][user.mail][status_blocked][body]' => 'Testing account blocked body.',
];
$this->drupalGet('admin/config/people/accounts/translate/fr/add');
$this->submitForm($edit, 'Save translation');
// Make sure the changes are saved and loaded back properly.
$this->drupalGet('admin/config/people/accounts/translate/fr/edit');
foreach ($edit as $key => $value) {
// Check the translations appear in the right field type as well.
$this->assertSession()
->fieldValueEquals($key, $value);
}
// Check that labels for email settings appear.
$this->assertSession()
->pageTextContains('Account cancellation confirmation');
$this->assertSession()
->pageTextContains('Password recovery');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.