public function ConfigTranslationUiTest::testAccountSettingsConfigurationTranslation in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php \Drupal\config_translation\Tests\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/ src/ Tests/ ConfigTranslationUiTest.php, line 477 - Contains \Drupal\config_translation\Tests\ConfigTranslationUiTest.
Class
- ConfigTranslationUiTest
- Translate settings and entities to various languages.
Namespace
Drupal\config_translation\TestsCode
public function testAccountSettingsConfigurationTranslation() {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/config/people/accounts');
$this
->assertLink(t('Translate @type', array(
'@type' => 'account settings',
)));
$this
->drupalGet('admin/config/people/accounts/translate');
$this
->assertLink(t('Translate @type', array(
'@type' => 'account settings',
)));
$this
->assertLinkByHref('admin/config/people/accounts/translate/fr/add');
// Update account settings fields for French.
$edit = array(
'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
->drupalPostForm('admin/config/people/accounts/translate/fr/add', $edit, t('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.
$xpath = '//' . (strpos($key, '[body]') ? 'textarea' : 'input') . '[@name="' . $key . '"]';
$this
->assertFieldByXPath($xpath, $value);
}
// Check that labels for email settings appear.
$this
->assertText(t('Account cancellation confirmation'));
$this
->assertText(t('Password recovery'));
}