3 namespace Drupal\config_translation\Tests;
5 use Drupal\simpletest\InstallerTestBase;
8 * Installs the config translation module on a site installed in non english.
10 * @group config_translation
12 class ConfigTranslationInstallTest extends InstallerTestBase {
17 protected $langcode = 'eo';
22 protected $profile = 'standard';
27 protected function setUpLanguage() {
28 // Place custom local translations in the translations directory.
29 mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
30 file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.eo.po', $this->getPo('eo'));
32 parent::setUpLanguage();
34 $this->translations['Save and continue'] = 'Save and continue eo';
38 * Returns the string for the test .po file.
40 * @param string $langcode
43 * Contents for the test .po file.
45 protected function getPo($langcode) {
50 msgid "Save and continue"
51 msgstr "Save and continue $langcode"
54 msgstr "Anonymous $langcode"
57 msgstr "Language $langcode"
61 public function testConfigTranslation() {
62 $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'en'], t('Add custom language'));
63 $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'fr'], t('Add custom language'));
66 'modules[config_translation][enable]' => TRUE,
68 $this->drupalPostForm('admin/modules', $edit, t('Install'));
70 $this->drupalGet('/admin/structure/types/manage/article/fields');
71 $this->assertResponse(200);