function SettingsTest::testGetNoDeprecationWhenNotConfiguredAndNoReplacement
Same name and namespace in other branches
- main core/tests/Drupal/Tests/Core/Site/SettingsTest.php \Drupal\Tests\Core\Site\SettingsTest::testGetNoDeprecationWhenNotConfiguredAndNoReplacement()
Tests Settings::get() does not warn for a not configured no-replacement setting.
@legacy-covers ::get
File
-
core/
tests/ Drupal/ Tests/ Core/ Site/ SettingsTest.php, line 281
Class
Namespace
Drupal\Tests\Core\SiteCode
public function testGetNoDeprecationWhenNotConfiguredAndNoReplacement() : void {
$deprecated_setting = [
'replacement' => '',
'message' => 'The fake_no_replacement setting is deprecated.',
];
$class = new \ReflectionClass(Settings::class);
$instance_property = $class->getProperty('deprecatedSettings');
$deprecated_settings = $instance_property->getValue();
$deprecated_settings['fake_no_replacement'] = $deprecated_setting;
$instance_property->setValue(NULL, $deprecated_settings);
// The setting is not in storage, so no deprecation should be triggered.
$this->assertNull(Settings::get('fake_no_replacement'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.