You are here

protected function SettingsTrait::addSettings in Automatic Updates 8.2

Appends some PHP code to settings.php.

Parameters

string $php: The PHP code to append to settings.php.

string $drupal_root: The path of the Drupal root.

string $site: (optional) The name of the site whose settings.php should be amended. Defaults to 'default'.

2 calls to SettingsTrait::addSettings()
UpdateTestBase::installQuickStart in tests/src/Build/UpdateTestBase.php
Install a Drupal site using the quick start feature.
UpdateTestBase::setReleaseMetadata in tests/src/Build/UpdateTestBase.php
Prepares the test site to serve an XML feed of available release metadata.

File

tests/src/Traits/SettingsTrait.php, line 23

Class

SettingsTrait
Provides methods for manipulating site settings.

Namespace

Drupal\Tests\automatic_updates\Traits

Code

protected function addSettings(string $php, string $drupal_root, string $site = 'default') : void {
  $settings = $this
    ->makeSettingsWritable($drupal_root, $site);
  $settings = fopen($settings, 'a');
  Assert::assertIsResource($settings);
  Assert::assertIsInt(fwrite($settings, $php));
  Assert::assertTrue(fclose($settings));
}