You are here

protected function InstallerTranslationExistingFileTest::setUpLanguage in Drupal 10

Same name and namespace in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php \Drupal\FunctionalTests\Installer\InstallerTranslationExistingFileTest::setUpLanguage()

Installer step: Select language.

Overrides InstallerTestBase::setUpLanguage

See also

\Drupal\Core\Installer\Form\SelectLanguageForm

File

core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php, line 32

Class

InstallerTranslationExistingFileTest
Tests translation files for multiple languages get imported during install.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function setUpLanguage() {

  // Place custom local translations in the translations directory.
  mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
  $po_contents = <<<ENDPO
msgid ""
msgstr ""
ENDPO;

  // Create a misnamed translation file that
  // \Drupal\Core\StringTranslation\Translator\FileTranslation::findTranslationFiles()
  // will not find.
  file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0-DEV.xx-lolspeak.po', $po_contents);
  parent::setUpLanguage();
}