Unverified Commit a95e1114 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3115159 by longwave, daffie, alexpott: Properly deprecate config.storage.staging service

parent f7a4b4b4
Loading
Loading
Loading
Loading
+4 −6
Changes for core/core.services.yml: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -330,14 +330,12 @@ services:
    class: Drupal\Core\Config\ExportStorageManager
    arguments: ['@config.storage', '@database', '@event_dispatcher', '@lock']
    public: false
  # @deprecated in Drupal 8.0.x and will be removed before 10.0.0. Use
  #   config.storage.sync instead.
  # @see https://www.drupal.org/node/2574957
  config.storage.staging:
  config.storage.sync:
    class: Drupal\Core\Config\FileStorage
    factory: Drupal\Core\Config\FileStorageFactory::getSync
  config.storage.sync:
    alias: config.storage.staging
  config.storage.staging:
    alias: config.storage.sync
    deprecated: The "%alias_id%" service is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use the "config.storage.sync" service instead. See https://www.drupal.org/node/2574957
  config.storage.snapshot:
    class: Drupal\Core\Config\DatabaseStorage
    arguments: ['@database', config_snapshot]
+5 −1
Changes for core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -149,7 +149,11 @@ private function parseDefinition($id, $service, $file)

        if (isset($service['alias'])) {
            $public = !array_key_exists('public', $service) || (bool) $service['public'];
            $this->container->setAlias($id, new Alias($service['alias'], $public));
            $alias = $this->container->setAlias($id, new Alias($service['alias'], $public));

            if (array_key_exists('deprecated', $service)) {
                $alias->setDeprecated(true, $service['deprecated']);
            }

            return;
        }
+25 −0
Changes for core/tests/Drupal/KernelTests/Core/Config/ConfigStorageStagingTest.php: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Drupal\KernelTests\Core\Config;

use Drupal\Core\Config\FileStorage;
use Drupal\KernelTests\KernelTestBase;

/**
 * Tests that the service "config.storage.staging" has been deprecated.
 *
 * @group Test
 * @group legacy
 */
class ConfigStorageStagingTest extends KernelTestBase {

  /**
   * @expectedDeprecation The "config.storage.staging" service is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use the "config.storage.sync" service instead. See https://www.drupal.org/node/2574957
   */
  public function testConfigStorageStagingDeprecation() {
    $storage_staging = \Drupal::service('config.storage.staging');
    // Ensure at least one assertion.
    $this->assertInstanceOf(FileStorage::class, $storage_staging);
  }

}