function MultipleDistributionsProfileTest::prepareEnvironment

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

Overrides FunctionalTestSetupTrait::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php, line 29

Class

MultipleDistributionsProfileTest
Tests multiple distribution profile support.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
    parent::prepareEnvironment();
    // Create two distributions.
    foreach ([
        'distribution_one',
        'distribution_two',
    ] as $name) {
        $info = [
            'type' => 'profile',
            'core_version_requirement' => '*',
            'name' => $name . ' profile',
            'distribution' => [
                'name' => $name,
                'install' => [
                    'theme' => 'claro',
                ],
            ],
        ];
        // File API functions are not available yet.
        $path = $this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/profiles/' . $name;
        mkdir($path, 0777, TRUE);
        file_put_contents("{$path}/{$name}.info.yml", Yaml::encode($info));
    }
    // Install the first distribution.
    $this->profile = 'distribution_one';
}

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