function SettingsTest::testGet
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Site/SettingsTest.php \Drupal\Tests\Core\Site\SettingsTest::testGet()
- 10 core/tests/Drupal/Tests/Core/Site/SettingsTest.php \Drupal\Tests\Core\Site\SettingsTest::testGet()
- 11.x 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\SiteCode
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.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.