Unverified Commit a95e1114 authored by alexpott's avatar alexpott
Browse files

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

parent f7a4b4b4
......@@ -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]
......
......@@ -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;
}
......
<?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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment