function InstallerTranslationExistingFileTest::setUpLanguage

Same name in other branches
  1. 10 core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php \Drupal\FunctionalTests\Installer\InstallerTranslationExistingFileTest::setUpLanguage()
  2. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php \Drupal\FunctionalTests\Installer\InstallerTranslationExistingFileTest::setUpLanguage()

Overrides InstallerTestBase::setUpLanguage

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.