class ConfigTranslationInstallTest
Same name and namespace in other branches
- 11.x core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationInstallTest
- 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationInstallTest
- 8.9.x core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationInstallTest
Installs the config translation module on a site installed in non english.
@group config_translation
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Installer\InstallerTestBase uses \Drupal\Tests\RequirementsPageTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\config_translation\Functional\ConfigTranslationInstallTest extends \Drupal\FunctionalTests\Installer\InstallerTestBase
- class \Drupal\FunctionalTests\Installer\InstallerTestBase uses \Drupal\Tests\RequirementsPageTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of ConfigTranslationInstallTest
File
-
core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationInstallTest.php, line 12
Namespace
Drupal\Tests\config_translation\FunctionalView source
class ConfigTranslationInstallTest extends InstallerTestBase {
/**
* {@inheritdoc}
*/
protected $langcode = 'eo';
/**
* {@inheritdoc}
*/
protected $profile = 'standard';
/**
* {@inheritdoc}
*/
protected function setUpLanguage() {
// Place custom local translations in the translations directory.
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';
}
/**
* Returns the string for the test .po file.
*
* @param string $langcode
* The language code.
*
* @return string
* Contents for the test .po file.
*/
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->drupalGet('admin/config/regional/language/add');
$this->submitForm([
'predefined_langcode' => 'en',
], 'Add custom language');
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm([
'predefined_langcode' => 'fr',
], 'Add custom language');
$edit = [
'modules[config_translation][enable]' => TRUE,
];
$this->drupalGet('admin/modules');
$this->submitForm($edit, 'Install');
$this->drupalGet('/admin/structure/types/manage/article/fields');
$this->assertSession()
->statusCodeEquals(200);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.