You are here

protected function InstallerExistingConfigSyncDirectoryMultilingualTest::prepareEnvironment in Drupal 10

Prepares the current environment for running the test.

Also sets up new resources for the testing environment, such as the public filesystem and configuration directories.

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