function KernelTestBase::setSetting

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setSetting()
  2. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setSetting()
  3. 11.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.

23 calls to KernelTestBase::setSetting()
DateFormatterTest::setUp in core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php
DateFormatterTest::testRfc2822DateFormat in core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php
Tests that an RFC2822 formatted date always returns an English string.
DirectoryTest::testFileCheckDirectoryHandling in core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php
Tests directory handling functions.
DrupalKernelSiteTest::testServicesYml in core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php
Tests services.yml in site directory.
DrupalKernelTest::getTestKernel in core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
Build a kernel for testings.

... See full list

File

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

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.