function InstallerExistingConfigSyncDirectoryMultilingualTest::prepareEnvironment

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

Overrides InstallerExistingConfigTestBase::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php, line 51

Class

InstallerExistingConfigSyncDirectoryMultilingualTest
Verifies that installing from existing configuration works.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
    parent::prepareEnvironment();
    // Place custom local translations in the translations directory and fix up
    // configuration.
    mkdir($this->publicFilesDirectory . '/translations', 0777, TRUE);
    file_put_contents($this->publicFilesDirectory . '/translations/drupal-8.0.0.es.po', $this->getPo('es'));
    $locale_settings = Yaml::decode(file_get_contents($this->siteDirectory . '/config/sync/locale.settings.yml'));
    $locale_settings['translation']['use_source'] = 'local';
    $locale_settings['translation']['path'] = $this->publicFilesDirectory . '/translations';
    file_put_contents($this->siteDirectory . '/config/sync/locale.settings.yml', Yaml::encode($locale_settings));
}

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