You are here

protected function DistributionProfileTranslationTest::prepareEnvironment in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php \Drupal\FunctionalTests\Installer\DistributionProfileTranslationTest::prepareEnvironment()
  2. 9 core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php \Drupal\FunctionalTests\Installer\DistributionProfileTranslationTest::prepareEnvironment()

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 FunctionalTestSetupTrait::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php, line 36

Class

DistributionProfileTranslationTest
Tests distribution profile support.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
  parent::prepareEnvironment();

  // We set core_version_requirement to '*' for the test so that it does not
  // need to be updated between major versions.
  $this->info = [
    'type' => 'profile',
    'core_version_requirement' => '*',
    'name' => 'Distribution profile',
    'distribution' => [
      'name' => 'My Distribution',
      'langcode' => $this->langcode,
      'install' => [
        'theme' => 'claro',
      ],
    ],
  ];

  // File API functions are not available yet.
  $path = $this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/profiles/my_distro';
  mkdir($path, 0777, TRUE);
  file_put_contents("{$path}/my_distro.info.yml", Yaml::encode($this->info));

  // Place a custom local translation in the translations directory.
  mkdir($this->root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
  file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this
    ->getPo('de'));
}