You are here

protected function FunctionalTestSetupTrait::writeSettings in Drupal 10

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

25 calls to FunctionalTestSetupTrait::writeSettings()
ConfigTest::testFileConfigurationPage in core/modules/system/tests/src/Functional/File/ConfigTest.php
Tests file configuration page.
ContainerRebuildWebTest::testContainerInvalidation in core/modules/system/tests/src/Functional/DrupalKernel/ContainerRebuildWebTest.php
Tests container invalidation.
ContainerRebuildWebTest::testSetContainerRebuildWithDifferentDeploymentIdentifier in core/modules/system/tests/src/Functional/DrupalKernel/ContainerRebuildWebTest.php
Sets a different deployment identifier.
DatabaseDriverProvidedByModuleTest::testDatabaseDriverIsProvidedByModuleButTheModuleIsNotEnabled in core/modules/system/tests/src/Functional/System/DatabaseDriverProvidedByModuleTest.php
Tests that the status page shows the error message.
DatabaseVersionCheckUpdateTest::testUpdate in core/modules/system/tests/src/Functional/Update/DatabaseVersionCheckUpdateTest.php
Tests that updates fail if the database does not meet the minimum version.

... 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 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);
}