You are here

protected function ConfigInstallerNestedDependenciesProfileTest::prepareEnvironment in Configuration installer 8

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

tests/src/Functional/ConfigInstallerNestedDependenciesProfileTest.php, line 19

Class

ConfigInstallerNestedDependenciesProfileTest
Tests the config installer profile with a profile with nested dependencies.

Namespace

Drupal\Tests\config_installer\Functional

Code

protected function prepareEnvironment() {
  parent::prepareEnvironment();
  $this->info = [
    'type' => 'profile',
    'core' => \Drupal::CORE_COMPATIBILITY,
    'name' => 'Profile with nested dependencies',
    'dependencies' => [
      'nested',
    ],
  ];

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

  // Add a required nested module to the profile.
  $this->nested = [
    'type' => 'module',
    'core' => \Drupal::CORE_COMPATIBILITY,
    'name' => 'Nested module',
  ];
  $nested_path = $path . '/modules/nested';
  mkdir($nested_path, 0777, TRUE);
  file_put_contents("{$nested_path}/nested.info.yml", Yaml::encode($this->nested));
}