protected function MultipleDistributionsProfileTest::prepareEnvironment in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php \Drupal\FunctionalTests\Installer\MultipleDistributionsProfileTest::prepareEnvironment()
- 10 core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php \Drupal\FunctionalTests\Installer\MultipleDistributionsProfileTest::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.
This method is private as it must only be called once by BrowserTestBase::setUp() (multiple invocations for the same test would have unpredictable consequences) and it must not be callable or overridable by test classes.
Overrides FunctionalTestSetupTrait::prepareEnvironment
File
- core/
tests/ Drupal/ FunctionalTests/ Installer/ MultipleDistributionsProfileTest.php, line 29
Class
- MultipleDistributionsProfileTest
- Tests multiple distribution profile support.
Namespace
Drupal\FunctionalTests\InstallerCode
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' => 'bartik',
],
],
];
// 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';
}