You are here

protected function KernelTestBase::setSetting in Drupal 10

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

19 calls to KernelTestBase::setSetting()
DateFormatterTest::setUp in core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php
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.
DrupalKernelTest::testClassLoaderAutoDetect in core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
Tests class_loader_auto_detect setting.

... See full list

File

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

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