function DistributionProfileTest::prepareEnvironment

Same name in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php \Drupal\FunctionalTests\Installer\DistributionProfileTest::prepareEnvironment()
  2. 10 core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php \Drupal\FunctionalTests\Installer\DistributionProfileTest::prepareEnvironment()
  3. 11.x core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php \Drupal\FunctionalTests\Installer\DistributionProfileTest::prepareEnvironment()

Overrides FunctionalTestSetupTrait::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php, line 26

Class

DistributionProfileTest
Tests distribution profile support.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
    parent::prepareEnvironment();
    $this->info = [
        'type' => 'profile',
        'core_version_requirement' => '*',
        'name' => 'Distribution profile',
        'distribution' => [
            'name' => 'My Distribution',
            'install' => [
                'theme' => 'claro',
                'finish_url' => '/root-user',
            ],
        ],
    ];
    // File API functions are not available yet.
    $path = $this->siteDirectory . '/profiles/my_distro';
    mkdir($path, 0777, TRUE);
    file_put_contents("{$path}/my_distro.info.yml", Yaml::encode($this->info));
    file_put_contents("{$path}/my_distro.install", "<?php function my_distro_install() {\\Drupal::entityTypeManager()->getStorage('path_alias')->create(['path' => '/user/1', 'alias' => '/root-user'])->save();}");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.