You are here

protected function SingleVisibleProfileTest::prepareEnvironment in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php \Drupal\FunctionalTests\Installer\SingleVisibleProfileTest::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/SingleVisibleProfileTest.php, line 31

Class

SingleVisibleProfileTest
Tests distribution profile support.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
  parent::prepareEnvironment();
  $profiles = [
    'standard',
    'demo_umami',
  ];
  foreach ($profiles as $profile) {
    $info = [
      'type' => 'profile',
      'core' => \Drupal::CORE_COMPATIBILITY,
      'name' => 'Override ' . $profile,
      'hidden' => TRUE,
    ];

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