function FunctionalTestSetupTrait::writeSettings

Same name in other branches
  1. 9 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::writeSettings()
  2. 10 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 drupal_rewrite_settings().

See also

drupal_rewrite_settings()

36 calls to FunctionalTestSetupTrait::writeSettings()
CommentUpdateTest::testCommentEntityTypeAndFieldUpdateRequirementsCheck in core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php
Test the update hook requirements check for 8701.
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

File

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

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);
    drupal_rewrite_settings($settings, $filename);
}

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