You are here

public function SettingsTest::testGet in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Site/SettingsTest.php \Drupal\Tests\Core\Site\SettingsTest::testGet()
  2. 9 core/tests/Drupal/Tests/Core/Site/SettingsTest.php \Drupal\Tests\Core\Site\SettingsTest::testGet()

@covers ::get

File

core/tests/Drupal/Tests/Core/Site/SettingsTest.php, line 47

Class

SettingsTest
@coversDefaultClass \Drupal\Core\Site\Settings @runTestsInSeparateProcesses @group Site

Namespace

Drupal\Tests\Core\Site

Code

public function testGet() {

  // Test stored settings.
  $this
    ->assertEquals($this->config['one'], Settings::get('one'), 'The correct setting was not returned.');
  $this
    ->assertEquals($this->config['two'], Settings::get('two'), 'The correct setting was not returned.');

  // Test setting that isn't stored with default.
  $this
    ->assertEquals('3', Settings::get('three', '3'), 'Default value for a setting not properly returned.');
  $this
    ->assertNull(Settings::get('four'), 'Non-null value returned for a setting that should not exist.');
}