You are here

protected function InstallerRouterTest::prepareEnvironment in Drupal 10

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

Class

InstallerRouterTest
Tests router rebuilding during installation.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
  parent::prepareEnvironment();
  $info = [
    'type' => 'profile',
    'core_version_requirement' => '*',
    'name' => 'Router testing profile',
    'install' => [
      'router_test',
      'router_installer_test',
    ],
  ];

  // File API functions are not available yet.
  $path = $this->siteDirectory . '/profiles/test_profile';
  mkdir($path, 0777, TRUE);
  file_put_contents("{$path}/test_profile.info.yml", Yaml::encode($info));
  $settings_services_file = DRUPAL_ROOT . '/sites/default/default.services.yml';
  copy($settings_services_file, $this->siteDirectory . '/services.yml');
  PerformanceTestRecorder::registerService($this->siteDirectory . '/services.yml', TRUE);
}