function FunctionalTestSetupTrait::writeSettings

Same name in other branches
  1. 9 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::writeSettings()
  2. 8.9.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::writeSettings()
  3. 11.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::writeSettings()

Rewrites the settings.php file of the test site.

Parameters

array $settings: An array of settings to write out, in the format expected by SettingsEditor::rewrite().

See also

\Drupal\Core\Site\SettingsEditor::rewrite()

42 calls to FunctionalTestSetupTrait::writeSettings()
AssetOptimizationTest::doTestAggregation in core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
Helper to test aggregate file URLs.
ConfigEntityFormOverrideTest::testFormsWithOverrides in core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php
Tests that overrides do not affect forms or listing screens.
ConfigExportUITest::setUp in core/modules/config/tests/src/Functional/ConfigExportUITest.php
ConfigFormOverrideTest::testFormsWithOverrides in core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php
Tests that overrides do not affect forms.
ConfigTest::testFileConfigurationPage in core/modules/system/tests/src/Functional/File/ConfigTest.php
Tests file configuration page.

... See full list

1 method overrides FunctionalTestSetupTrait::writeSettings()
SecurityAdvisoryTest::writeSettings in core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php
Rewrites the settings.php file of the test site.

File

core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php, line 186

Class

FunctionalTestSetupTrait
Defines a trait for shared functional test setup functionality.

Namespace

Drupal\Core\Test

Code

protected function writeSettings(array $settings) {
    include_once DRUPAL_ROOT . '/core/includes/install.inc';
    $filename = $this->siteDirectory . '/settings.php';
    // system_requirements() removes write permissions from settings.php
    // whenever it is invoked.
    // Not using File API; a potential error must trigger a PHP warning.
    chmod($filename, 0666);
    SettingsEditor::rewrite($filename, $settings);
}

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