function InstallerNonEnglishProfileWithoutLocaleModuleTest::prepareEnvironment

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

Overrides FunctionalTestSetupTrait::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php, line 36

Class

InstallerNonEnglishProfileWithoutLocaleModuleTest
Tests installing a profile with non-English language and no locale module.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() : void {
    parent::prepareEnvironment();
    // Create a self::PROFILE testing profile that depends on the 'language'
    // module but not on 'locale' module. We set core_version_requirement to '*'
    // for the test so that it does not need to be updated between major
    // versions.
    $profile_info = [
        'type' => 'profile',
        'core_version_requirement' => '*',
        'name' => 'Test with language but without locale',
        'install' => [
            'language',
        ],
    ];
    // File API functions are not available yet.
    $profile_dir = "{$this->root}/{$this->siteDirectory}/profiles/" . self::PROFILE;
    $profile_config_dir = "{$profile_dir}/config/install";
    mkdir($profile_config_dir, 0777, TRUE);
    $profile_info_file = $profile_dir . '/' . static::PROFILE . '.info.yml';
    file_put_contents($profile_info_file, Yaml::encode($profile_info));
    // Copy a non-English language config YAML to be installed with the profile.
    copy($this->root . '/core/profiles/testing_multilingual/config/install/language.entity.de.yml', $profile_config_dir . '/language.entity.de.yml');
}

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