ConfigTranslationInstallTest.php in Zircon Profile 8.0
File
core/modules/config_translation/src/Tests/ConfigTranslationInstallTest.php
View source
<?php
namespace Drupal\config_translation\Tests;
use Drupal\simpletest\InstallerTestBase;
class ConfigTranslationInstallTest extends InstallerTestBase {
protected $langcode = 'eo';
protected $profile = 'standard';
protected function setUpLanguage() {
mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.eo.po', $this
->getPo('eo'));
parent::setUpLanguage();
$this->translations['Save and continue'] = 'Save and continue eo';
}
protected function getPo($langcode) {
return <<<ENDPO
msgid ""
msgstr ""
msgid "Save and continue"
msgstr "Save and continue {<span class="php-variable">$langcode</span>}"
msgid "Anonymous"
msgstr "Anonymous {<span class="php-variable">$langcode</span>}"
msgid "Language"
msgstr "Language {<span class="php-variable">$langcode</span>}"
ENDPO;
}
public function testConfigTranslation() {
$this
->drupalPostForm('admin/config/regional/language/add', [
'predefined_langcode' => 'en',
], t('Add custom language'));
$this
->drupalPostForm('admin/config/regional/language/add', [
'predefined_langcode' => 'fr',
], t('Add custom language'));
$edit = [
'modules[Multilingual][config_translation][enable]' => TRUE,
];
$this
->drupalPostForm('admin/modules', $edit, t('Install'));
$this
->drupalGet('/admin/structure/types/manage/article/fields');
$this
->assertResponse(200);
}
}