function SuperUserAccessInstallTest::prepareEnvironment
Same name in other branches
- 10 core/tests/Drupal/FunctionalTests/Installer/SuperUserAccessInstallTest.php \Drupal\FunctionalTests\Installer\SuperUserAccessInstallTest::prepareEnvironment()
Overrides FunctionalTestSetupTrait::prepareEnvironment
File
-
core/
tests/ Drupal/ FunctionalTests/ Installer/ SuperUserAccessInstallTest.php, line 37
Class
- SuperUserAccessInstallTest
- Tests superuser access and the installer.
Namespace
Drupal\FunctionalTests\InstallerCode
protected function prepareEnvironment() : void {
parent::prepareEnvironment();
$info = [
'type' => 'profile',
'core_version_requirement' => '*',
'name' => 'Superuser testing profile',
];
// File API functions are not available yet.
$path = $this->siteDirectory . '/profiles/superuser';
mkdir($path, 0777, TRUE);
file_put_contents("{$path}/superuser.info.yml", Yaml::encode($info));
file_put_contents("{$path}/superuser.install", $this->providedData()['install_code']);
$services = Yaml::decode(file_get_contents(DRUPAL_ROOT . '/sites/default/default.services.yml'));
$services['parameters']['security.enable_super_user'] = $this->providedData()['super_user_policy'];
file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/services.yml', Yaml::encode($services));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.