function KernelTestBase::setSetting

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setSetting()
  2. 10 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setSetting()
  3. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setSetting()

Sets an in-memory Settings variable.

Parameters

string $name: The name of the setting to set.

bool|string|int|array|null $value: The value to set. Note that array values are replaced entirely; use \Drupal\Core\Site\Settings::get() to perform custom merges.

3 calls to KernelTestBase::setSetting()
FileUrlTest::testFilesUrlWithDifferentHostName in core/modules/file/tests/src/Kernel/FileUrlTest.php
Tests public files with a different host name from settings.
MigratePrivateFileTest::setUp in core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php
StreamWrapperTest::setUp in core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 937

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function setSetting($name, $value) {
  $settings = Settings::getInstance() ? Settings::getAll() : [];
  $settings[$name] = $value;
  new Settings($settings);
}

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