function DistributionProfileTranslationQueryTest::prepareEnvironment

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php \Drupal\FunctionalTests\Installer\DistributionProfileTranslationQueryTest::prepareEnvironment()
  2. 8.9.x core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php \Drupal\FunctionalTests\Installer\DistributionProfileTranslationQueryTest::prepareEnvironment()
  3. 11.x core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php \Drupal\FunctionalTests\Installer\DistributionProfileTranslationQueryTest::prepareEnvironment()

Overrides FunctionalTestSetupTrait::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php, line 38

Class

DistributionProfileTranslationQueryTest
Tests distribution profile support with a 'langcode' query string.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
    parent::prepareEnvironment();
    $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_distribution';
    mkdir($path, 0777, TRUE);
    file_put_contents("{$path}/my_distribution.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'));
    file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.fr.po', $this->getPo('fr'));
}

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