You are here

protected function InstallerRouterTest::prepareEnvironment in Drupal 9

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/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);
}