function HelpTopicTranslatedTestBase::installParameters
Same name in other branches
- 9 core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php \Drupal\Tests\help_topics\Functional\HelpTopicTranslatedTestBase::installParameters()
- 8.9.x core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php \Drupal\Tests\help_topics\Functional\HelpTopicTranslatedTestBase::installParameters()
- 10 core/modules/help/tests/src/Functional/HelpTopicTranslatedTestBase.php \Drupal\Tests\help\Functional\HelpTopicTranslatedTestBase::installParameters()
Overrides FunctionalTestSetupTrait::installParameters
File
-
core/
modules/ help/ tests/ src/ Functional/ HelpTopicTranslatedTestBase.php, line 62
Class
- HelpTopicTranslatedTestBase
- Provides a base class for functional help topic tests that use translation.
Namespace
Drupal\Tests\help\FunctionalCode
protected function installParameters() {
$parameters = parent::installParameters();
// Install in German. This will ensure the language and locale modules are
// installed.
$parameters['parameters']['langcode'] = 'de';
// Create a po file so we don't attempt to download one from
// localize.drupal.org and to have a test translation that will not change.
\Drupal::service('file_system')->mkdir($this->publicFilesDirectory . '/translations', NULL, TRUE);
$contents = <<<PO
msgid ""
msgstr ""
msgid "ABC Help Test module"
msgstr "ABC-Hilfetestmodul"
msgid "Test translation."
msgstr "Übersetzung testen."
msgid "Non-word-item to translate."
msgstr "Non-word-german sdfwedrsdf."
PO;
$version = explode('.', \Drupal::VERSION)[0] . '.0.0';
file_put_contents($this->publicFilesDirectory . "/translations/drupal-{$version}.de.po", $contents);
return $parameters;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.