You are here

public function SettingsTest::testRealDeprecatedSettings in Drupal 9

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 286

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);
}