You are here

protected function KernelTestBase::setSetting in Drupal 8

Same name and namespace in other branches
  1. 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.

20 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
Test 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::testPrepareLegacyRequest in core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
@group legacy @expectedDeprecation Drupal\Core\DrupalKernel::prepareLegacyRequest is deprecated drupal:8.0.0 and is removed from drupal:9.0.0. Use DrupalKernel::boot() and DrupalKernel::preHandle() instead. See https://www.drupal.org/node/3070678

... See full list

File

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

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function setSetting($name, $value) {
  if ($name === 'install_profile') {
    @trigger_error('Use \\Drupal\\KernelTests\\KernelTestBase::setInstallProfile() to set the install profile in kernel tests. See https://www.drupal.org/node/2538996', E_USER_DEPRECATED);
    $this
      ->setInstallProfile($value);
  }
  $settings = Settings::getInstance() ? Settings::getAll() : [];
  $settings[$name] = $value;
  new Settings($settings);
}