function TemplateProjectTestBase::writeSettings

Appends PHP code to the test site's settings.php.

Parameters

string $php: The PHP code to append to the test site's settings.php.

3 calls to TemplateProjectTestBase::writeSettings()
TemplateProjectTestBase::createTestProject in core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php
Creates a test project from a given template and installs Drupal.
TemplateProjectTestBase::installQuickStart in core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php
TemplateProjectTestBase::setReleaseMetadata in core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php
Prepares the test site to serve an XML feed of available release metadata.

File

core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php, line 531

Class

TemplateProjectTestBase
Base class for tests which create a test site from a core project template.

Namespace

Drupal\Tests\package_manager\Build

Code

protected function writeSettings(string $php) : void {
    // Ensure settings are writable, since this is the only way we can set
    // configuration values that aren't accessible in the UI.
    $file = $this->getWebRoot() . '/sites/default/settings.php';
    $this->assertFileExists($file);
    chmod(dirname($file), 0744);
    chmod($file, 0744);
    $this->assertFileIsWritable($file);
    $this->assertIsInt(file_put_contents($file, $php, FILE_APPEND));
}

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