public function ConfigTranslationUiTest::testAccountSettingsConfigurationTranslation in Drupal 9
Same name and namespace in other branches
- 8 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 523
Class
- ConfigTranslationUiTest
- Translate settings and entities to various languages.
Namespace
Drupal\Tests\config_translation\FunctionalCode
public function testAccountSettingsConfigurationTranslation() {
$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');
}