function SettingsTest::providerTestFakeDeprecatedSettings

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/Site/SettingsTest.php \Drupal\Tests\Core\Site\SettingsTest::providerTestFakeDeprecatedSettings()
  2. 11.x core/tests/Drupal/Tests/Core/Site/SettingsTest.php \Drupal\Tests\Core\Site\SettingsTest::providerTestFakeDeprecatedSettings()

Provides data for testFakeDeprecatedSettings().

Note: Tests for real deprecated settings should not be added here.

See also

self::providerTestRealDeprecatedSettings()

File

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

Class

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

Namespace

Drupal\Tests\Core\Site

Code

public function providerTestFakeDeprecatedSettings() : array {
    $only_legacy = [
        'deprecated_legacy' => 'old',
    ];
    $only_replacement = [
        'happy_replacement' => 'new',
    ];
    $both_settings = [
        'deprecated_legacy' => 'old',
        'happy_replacement' => 'new',
    ];
    return [
        'Only legacy defined, get legacy' => [
            $only_legacy,
            'deprecated_legacy',
            'old',
        ],
        'Only legacy defined, get replacement' => [
            $only_legacy,
            'happy_replacement',
            // Since the new setting isn't yet defined, use the old value.
'old',
        ],
        'Both legacy and replacement defined, get legacy' => [
            $both_settings,
            'deprecated_legacy',
            // Since the replacement is already defined, that should be used.
'new',
        ],
        'Both legacy and replacement defined, get replacement' => [
            $both_settings,
            'happy_replacement',
            'new',
        ],
        'Only replacement defined, get legacy' => [
            $only_replacement,
            'deprecated_legacy',
            // Should get the new value.
'new',
        ],
        'Only replacement defined, get replacement' => [
            $only_replacement,
            'happy_replacement',
            // Should get the new value.
'new',
            // No deprecation since the old name is neither used nor defined.
FALSE,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.