You are here

public function SettingsTest::testRealDeprecatedSettings in Drupal 10

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

Tests deprecation messages for real deprecated settings.

@dataProvider providerTestRealDeprecatedSettings @group legacy

Parameters

string $legacy_setting: The legacy name of the setting to test.

string $expected_deprecation: The expected deprecation message.

File

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

Class

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

Namespace

Drupal\Tests\Core\Site

Code

public function testRealDeprecatedSettings(string $legacy_setting, string $expected_deprecation) : void {
  $settings_file_content = "<?php\n\$settings['{$legacy_setting}'] = 'foo';\n";
  $class_loader = NULL;
  $vfs_root = vfsStream::setup('root');
  $sites_directory = vfsStream::newDirectory('sites')
    ->at($vfs_root);
  vfsStream::newFile('settings.php')
    ->at($sites_directory)
    ->setContent($settings_file_content);
  $this
    ->expectDeprecation($expected_deprecation);

  // Presence of the old name in settings.php is enough to trigger messages.
  Settings::initialize(vfsStream::url('root'), 'sites', $class_loader);
}