Commit bfb117c5 authored by xjm's avatar xjm

Issue #2487588 by YesCT, Leksat, Schnitzel, alexpott, anavarre, xjm: Move CMI...

Issue #2487588 by YesCT, Leksat, Schnitzel, alexpott, anavarre, xjm: Move CMI import/export directory "staging" to "sync", as it is confused with staging environments
parent 09990f57
......@@ -115,7 +115,7 @@
* and HAL.
* - Node entity support is configured by default. If you would like to support
* other types of entities, you can copy
* core/modules/rest/config/install/rest.settings.yml to your staging
* core/modules/rest/config/install/rest.settings.yml to your sync
* configuration directory, appropriately modified for other entity types,
* and import it. Support for GET on the log from the Database Logging module
* can also be enabled in this way; in this case, the 'entity:node' line
......
......@@ -290,9 +290,13 @@ services:
public: false
tags:
- { name: backend_overridable }
# @deprecated in Drupal 8.0.x and will be removed before 9.0.0. Use
# config.storage.sync instead.
config.storage.staging:
class: Drupal\Core\Config\FileStorage
factory: Drupal\Core\Config\FileStorageFactory::getStaging
factory: Drupal\Core\Config\FileStorageFactory::getSync
config.storage.sync:
alias: config.storage.staging
config.storage.snapshot:
class: Drupal\Core\Config\DatabaseStorage
arguments: ['@database', config_snapshot]
......
......@@ -108,10 +108,21 @@
*/
const CONFIG_ACTIVE_DIRECTORY = 'active';
/**
* $config_directories key for sync directory.
*
* @see config_get_config_directory()
*/
const CONFIG_SYNC_DIRECTORY = 'sync';
/**
* $config_directories key for staging directory.
*
* @see config_get_config_directory()
* @see CONFIG_SYNC_DIRECTORY
*
* @deprecated in Drupal 8.0.x and will be removed before 9.0.0. The staging
* directory was renamed to sync.
*/
const CONFIG_STAGING_DIRECTORY = 'staging';
......@@ -130,7 +141,7 @@
*
* @param string $type
* The type of config directory to return. Drupal core provides the
* CONFIG_STAGING_DIRECTORY constant to access the staging directory.
* CONFIG_SYNC_DIRECTORY constant to access the sync directory.
*
* @return string
* The configuration directory path.
......@@ -140,6 +151,11 @@
function config_get_config_directory($type) {
global $config_directories;
// @todo Remove fallback in Drupal 9. https://www.drupal.org/node/2574943
if ($type == CONFIG_SYNC_DIRECTORY && !isset($config_directories[CONFIG_SYNC_DIRECTORY]) && isset($config_directories[CONFIG_STAGING_DIRECTORY])) {
$type = CONFIG_STAGING_DIRECTORY;
}
if (!empty($config_directories[$type])) {
return $config_directories[$type];
}
......
......@@ -335,7 +335,7 @@ function file_ensure_htaccess() {
file_save_htaccess('private://', TRUE);
}
file_save_htaccess('temporary://', TRUE);
file_save_htaccess(config_get_config_directory(CONFIG_STAGING_DIRECTORY), TRUE);
file_save_htaccess(config_get_config_directory(CONFIG_SYNC_DIRECTORY), TRUE);
}
/**
......
......@@ -362,7 +362,7 @@ function install_begin_request($class_loader, &$install_state) {
\Drupal::setContainer($container);
// Determine whether base system services are ready to operate.
$install_state['config_verified'] = install_ensure_config_directory(CONFIG_STAGING_DIRECTORY);
$install_state['config_verified'] = install_ensure_config_directory(CONFIG_SYNC_DIRECTORY);
$install_state['database_verified'] = install_verify_database_settings($site_path);
$install_state['settings_verified'] = $install_state['config_verified'] && $install_state['database_verified'];
......
......@@ -202,8 +202,8 @@ function drupal_get_database_types() {
* and comment properties.
* @code
* $settings['config_directories'] = array(
* CONFIG_STAGING_DIRECTORY => (object) array(
* 'value' => 'config_hash/staging',
* CONFIG_SYNC_DIRECTORY => (object) array(
* 'value' => 'config_hash/sync',
* 'required' => TRUE,
* ),
* );
......@@ -211,7 +211,7 @@ function drupal_get_database_types() {
* gets dumped as:
* @code
* $config_directories['active'] = 'config_hash/active';
* $config_directories['staging'] = 'config_hash/staging'
* $config_directories['sync'] = 'config_hash/sync'
* @endcode
*/
function drupal_rewrite_settings($settings = array(), $settings_file = NULL) {
......@@ -487,9 +487,9 @@ function drupal_install_config_directories() {
// manually defined in the existing already.
$settings = [];
$config_directories_hash = Crypt::randomBytesBase64(55);
if (empty($config_directories[CONFIG_STAGING_DIRECTORY])) {
$settings['config_directories'][CONFIG_STAGING_DIRECTORY] = (object) [
'value' => \Drupal::service('site.path') . '/files/config_' . $config_directories_hash . '/staging',
if (empty($config_directories[CONFIG_SYNC_DIRECTORY])) {
$settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [
'value' => \Drupal::service('site.path') . '/files/config_' . $config_directories_hash . '/sync',
'required' => TRUE,
];
}
......@@ -505,19 +505,19 @@ function drupal_install_config_directories() {
// public files directory, which has already been verified to be writable
// itself. But if it somehow fails anyway, the installation cannot proceed.
// Bail out using a similar error message as in system_requirements().
if (!install_ensure_config_directory(CONFIG_STAGING_DIRECTORY)) {
if (!install_ensure_config_directory(CONFIG_SYNC_DIRECTORY)) {
throw new Exception(t('The directory %directory could not be created or could not be made writable. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see the <a href=":handbook_url">online handbook</a>.', array(
'%directory' => config_get_config_directory(CONFIG_STAGING_DIRECTORY),
'%directory' => config_get_config_directory(CONFIG_SYNC_DIRECTORY),
':handbook_url' => 'https://www.drupal.org/server-permissions',
)));
}
// Put a README.txt into the staging config directory. This is required so
// that they can later be added to git. Since this directory is auto-
// created, we have to write out the README rather than just adding it
// to the drupal core repo.
// Put a README.txt into the sync config directory. This is required so that
// they can later be added to git. Since this directory is auto-created, we
// have to write out the README rather than just adding it to the drupal core
// repo.
$text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
file_put_contents(config_get_config_directory(CONFIG_STAGING_DIRECTORY) . '/README.txt', $text);
file_put_contents(config_get_config_directory(CONFIG_SYNC_DIRECTORY) . '/README.txt', $text);
}
/**
......@@ -525,7 +525,7 @@ function drupal_install_config_directories() {
*
* @param string $type
* Type of config directory to return. Drupal core provides 'active' and
* 'staging'.
* 'sync'.
*
* @return bool
* TRUE if the config directory exists and is writable.
......
......@@ -367,8 +367,8 @@ protected function createExtensionChangelist() {
$current_extensions = $this->storageComparer->getTargetStorage()->read('core.extension');
$new_extensions = $this->storageComparer->getSourceStorage()->read('core.extension');
// If there is no extension information in staging then exit. This is
// probably due to an empty staging directory.
// If there is no extension information in sync then exit. This is probably
// due to an empty sync directory.
if (!$new_extensions) {
return;
}
......@@ -780,7 +780,7 @@ protected function processConfiguration($collection, $op, $name) {
* The name of the extension to process.
*/
protected function processExtension($type, $op, $name) {
// Set the config installer to use the staging directory instead of the
// Set the config installer to use the sync directory instead of the
// extensions own default config directories.
\Drupal::service('config.installer')
->setSyncing(TRUE)
......
......@@ -85,9 +85,9 @@
* configuration object so that they can be checked without the module that
* provides the configuration entity class being installed. This is important
* for configuration synchronization, which needs to be able to validate
* configuration in the staging directory before the synchronization has
* occurred. Also, if you have a configuration entity object and you want to
* get the current dependencies (without recalculation), you can use
* configuration in the sync directory before the synchronization has occurred.
* Also, if you have a configuration entity object and you want to get the
* current dependencies (without recalculation), you can use
* \Drupal\Core\Config\Entity\ConfigEntityInterface::getDependencies().
*
* When uninstalling a module or a theme, configuration entities that are
......
......@@ -25,12 +25,12 @@ static function getActive() {
}
/**
* Returns a FileStorage object working with the staging config directory.
* Returns a FileStorage object working with the sync config directory.
*
* @return \Drupal\Core\Config\FileStorage FileStorage
*/
static function getStaging() {
return new FileStorage(config_get_config_directory(CONFIG_STAGING_DIRECTORY));
static function getSync() {
return new FileStorage(config_get_config_directory(CONFIG_SYNC_DIRECTORY));
}
}
......@@ -33,7 +33,7 @@ function config_help($route_name, RouteMatchInterface $route_match) {
case 'config.sync':
$output = '';
$output .= '<p>' . t('Compare the configuration uploaded to your staging directory with the active configuration before completing the import.') . '</p>';
$output .= '<p>' . t('Compare the configuration uploaded to your sync directory with the active configuration before completing the import.') . '</p>';
return $output;
case 'config.export_full':
......@@ -43,7 +43,7 @@ function config_help($route_name, RouteMatchInterface $route_match) {
case 'config.import_full':
$output = '';
$output .= '<p>' . t('Upload a full site configuration archive to the staging directory. It can then be compared and imported on the Synchronize page.') . '</p>';
$output .= '<p>' . t('Upload a full site configuration archive to the sync directory. It can then be compared and imported on the Synchronize page.') . '</p>';
return $output;
case 'config.export_single':
......
......@@ -64,7 +64,7 @@ class ConfigController implements ContainerInjectionInterface {
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.storage'),
$container->get('config.storage.staging'),
$container->get('config.storage.sync'),
$container->get('config.manager'),
new FileDownloadController(),
$container->get('diff.formatter')
......
......@@ -40,7 +40,7 @@ public function __construct(StorageInterface $config_storage) {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.storage.staging')
$container->get('config.storage.sync')
);
}
......@@ -93,7 +93,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ($archiver->listContent() as $file) {
$files[] = $file['filename'];
}
$archiver->extractList($files, config_get_config_directory(CONFIG_STAGING_DIRECTORY));
$archiver->extractList($files, config_get_config_directory(CONFIG_SYNC_DIRECTORY));
drupal_set_message($this->t('Your configuration files were successfully uploaded and are ready for import.'));
$form_state->setRedirect('config.sync');
}
......
......@@ -39,11 +39,11 @@ class ConfigSync extends FormBase {
protected $lock;
/**
* The staging configuration object.
* The sync configuration object.
*
* @var \Drupal\Core\Config\StorageInterface
*/
protected $stagingStorage;
protected $syncStorage;
/**
* The active configuration object.
......@@ -111,7 +111,7 @@ class ConfigSync extends FormBase {
/**
* Constructs the object.
*
* @param \Drupal\Core\Config\StorageInterface $staging_storage
* @param \Drupal\Core\Config\StorageInterface $sync_storage
* The source storage.
* @param \Drupal\Core\Config\StorageInterface $active_storage
* The target storage.
......@@ -134,8 +134,8 @@ class ConfigSync extends FormBase {
* @param \Drupal\Core\Render\RendererInterface
* The renderer.
*/
public function __construct(StorageInterface $staging_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, RendererInterface $renderer) {
$this->stagingStorage = $staging_storage;
public function __construct(StorageInterface $sync_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, RendererInterface $renderer) {
$this->syncStorage = $sync_storage;
$this->activeStorage = $active_storage;
$this->snapshotStorage = $snapshot_storage;
$this->lock = $lock;
......@@ -153,7 +153,7 @@ public function __construct(StorageInterface $staging_storage, StorageInterface
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.storage.staging'),
$container->get('config.storage.sync'),
$container->get('config.storage'),
$container->get('config.storage.snapshot'),
$container->get('lock.persistent'),
......@@ -183,8 +183,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'submit',
'#value' => $this->t('Import all'),
);
$source_list = $this->stagingStorage->listAll();
$storage_comparer = new StorageComparer($this->stagingStorage, $this->activeStorage, $this->configManager);
$source_list = $this->syncStorage->listAll();
$storage_comparer = new StorageComparer($this->syncStorage, $this->activeStorage, $this->configManager);
if (empty($source_list) || !$storage_comparer->createChangelist()->hasChanges()) {
$form['no_changes'] = array(
'#type' => 'table',
......
......@@ -28,8 +28,8 @@ public function assertConfigEntityImport(ConfigEntityInterface $entity) {
$entity_uuid = $entity->uuid();
$entity_type_id = $entity->getEntityTypeId();
$original_data = $entity->toArray();
// Copy everything to staging.
$this->copyConfig(\Drupal::service('config.storage'), \Drupal::service('config.storage.staging'));
// Copy everything to sync.
$this->copyConfig(\Drupal::service('config.storage'), \Drupal::service('config.storage.sync'));
// Delete the configuration from active. Don't worry about side effects of
// deleting config like fields cleaning up field storages. The coming import
// should recreate everything as necessary.
......
......@@ -28,7 +28,7 @@ class ConfigDiffTest extends KernelTestBase {
*/
function testDiff() {
$active = $this->container->get('config.storage');
$staging = $this->container->get('config.storage.staging');
$sync = $this->container->get('config.storage.sync');
$config_name = 'config_test.system';
$change_key = 'foo';
$remove_key = '404';
......@@ -43,44 +43,44 @@ function testDiff() {
// Install the default config.
$this->installConfig(array('config_test'));
// Change a configuration value in staging.
$staging_data = $original_data;
$staging_data[$change_key] = $change_data;
$staging_data[$add_key] = $add_data;
$staging->write($config_name, $staging_data);
// Change a configuration value in sync.
$sync_data = $original_data;
$sync_data[$change_key] = $change_data;
$sync_data[$add_key] = $add_data;
$sync->write($config_name, $sync_data);
// Verify that the diff reflects a change.
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name);
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
$edits = $diff->getEdits();
$this->assertEqual($edits[0]->type, 'change', 'The first item in the diff is a change.');
$this->assertEqual($edits[0]->orig[0], $change_key . ': ' . $original_data[$change_key], format_string("The active value for key '%change_key' is '%original_data'.", array('%change_key' => $change_key, '%original_data' => $original_data[$change_key])));
$this->assertEqual($edits[0]->closing[0], $change_key . ': ' . $change_data, format_string("The staging value for key '%change_key' is '%change_data'.", array('%change_key' => $change_key, '%change_data' => $change_data)));
$this->assertEqual($edits[0]->closing[0], $change_key . ': ' . $change_data, format_string("The sync value for key '%change_key' is '%change_data'.", array('%change_key' => $change_key, '%change_data' => $change_data)));
// Reset data back to original, and remove a key
$staging_data = $original_data;
unset($staging_data[$remove_key]);
$staging->write($config_name, $staging_data);
$sync_data = $original_data;
unset($sync_data[$remove_key]);
$sync->write($config_name, $sync_data);
// Verify that the diff reflects a removed key.
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name);
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
$edits = $diff->getEdits();
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
$this->assertEqual($edits[1]->type, 'delete', 'The second item in the diff is a delete.');
$this->assertEqual($edits[1]->orig[0], $remove_key . ': ' . $original_data[$remove_key], format_string("The active value for key '%remove_key' is '%original_data'.", array('%remove_key' => $remove_key, '%original_data' => $original_data[$remove_key])));
$this->assertFalse($edits[1]->closing, format_string("The key '%remove_key' does not exist in staging.", array('%remove_key' => $remove_key)));
$this->assertFalse($edits[1]->closing, format_string("The key '%remove_key' does not exist in sync.", array('%remove_key' => $remove_key)));
// Reset data back to original and add a key
$staging_data = $original_data;
$staging_data[$add_key] = $add_data;
$staging->write($config_name, $staging_data);
$sync_data = $original_data;
$sync_data[$add_key] = $add_data;
$sync->write($config_name, $sync_data);
// Verify that the diff reflects an added key.
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name);
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
$edits = $diff->getEdits();
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
$this->assertEqual($edits[1]->type, 'add', 'The second item in the diff is an add.');
$this->assertFalse($edits[1]->orig, format_string("The key '%add_key' does not exist in active.", array('%add_key' => $add_key)));
$this->assertEqual($edits[1]->closing[0], $add_key . ': ' . $add_data, format_string("The staging value for key '%add_key' is '%add_data'.", array('%add_key' => $add_key, '%add_data' => $add_data)));
$this->assertEqual($edits[1]->closing[0], $add_key . ': ' . $add_data, format_string("The sync value for key '%add_key' is '%add_data'.", array('%add_key' => $add_key, '%add_data' => $add_data)));
// Test diffing a renamed config entity.
$test_entity_id = $this->randomMachineName();
......@@ -90,9 +90,9 @@ function testDiff() {
));
$test_entity->save();
$data = $active->read('config_test.dynamic.' . $test_entity_id);
$staging->write('config_test.dynamic.' . $test_entity_id, $data);
$sync->write('config_test.dynamic.' . $test_entity_id, $data);
$config_name = 'config_test.dynamic.' . $test_entity_id;
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name, $config_name);
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name, $config_name);
// Prove the fields match.
$edits = $diff->getEdits();
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
......@@ -103,7 +103,7 @@ function testDiff() {
$test_entity->set('id', $new_test_entity_id);
$test_entity->save();
$diff = \Drupal::service('config.manager')->diff($active, $staging, 'config_test.dynamic.' . $new_test_entity_id, $config_name);
$diff = \Drupal::service('config.manager')->diff($active, $sync, 'config_test.dynamic.' . $new_test_entity_id, $config_name);
$edits = $diff->getEdits();
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
$this->assertEqual($edits[1]->type, 'change', 'The second item in the diff is a change.');
......@@ -119,27 +119,27 @@ function testDiff() {
function testCollectionDiff() {
/** @var \Drupal\Core\Config\StorageInterface $active */
$active = $this->container->get('config.storage');
/** @var \Drupal\Core\Config\StorageInterface $staging */
$staging = $this->container->get('config.storage.staging');
/** @var \Drupal\Core\Config\StorageInterface $sync */
$sync = $this->container->get('config.storage.sync');
$active_test_collection = $active->createCollection('test');
$staging_test_collection = $staging->createCollection('test');
$sync_test_collection = $sync->createCollection('test');
$config_name = 'config_test.test';
$data = array('foo' => 'bar');
$active->write($config_name, $data);
$staging->write($config_name, $data);
$sync->write($config_name, $data);
$active_test_collection->write($config_name, $data);
$staging_test_collection->write($config_name, array('foo' => 'baz'));
$sync_test_collection->write($config_name, array('foo' => 'baz'));
// Test the fields match in the default collection diff.
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name);
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
$edits = $diff->getEdits();
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
$this->assertEqual(count($edits), 1, 'There is one item in the diff');
// Test that the differences are detected when diffing the collection.
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name, NULL, 'test');
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name, NULL, 'test');
$edits = $diff->getEdits();
$this->assertEqual($edits[0]->type, 'change', 'The second item in the diff is a copy.');
$this->assertEqual($edits[0]->orig, array('foo: bar'));
......
......@@ -11,7 +11,7 @@
use Drupal\Core\Config\ConfigDuplicateUUIDException;
/**
* Tests staging and importing config entities with IDs and UUIDs that match
* Tests sync and importing config entities with IDs and UUIDs that match
* existing config.
*
* @group config
......
......@@ -191,21 +191,21 @@ public function testExportImport() {
// Ensure the item is displayed as part of a list (to avoid false matches
// on the rest of the page) and that the list markup is not escaped.
$this->assertRaw('<li>system.site</li>');
// Remove everything from staging. The warning about differences between the
// Remove everything from sync. The warning about differences between the
// active and snapshot should no longer exist.
\Drupal::service('config.storage.staging')->deleteAll();
\Drupal::service('config.storage.sync')->deleteAll();
$this->drupalGet('admin/config/development/configuration');
$this->assertNoText(t('Warning message'));
$this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
$this->assertText(t('There are no configuration changes to import.'));
// Write a file to staging. The warning about differences between the
// active and snapshot should now exist.
/** @var \Drupal\Core\Config\StorageInterface $staging */
$staging = $this->container->get('config.storage.staging');
// Write a file to sync. The warning about differences between the active
// and snapshot should now exist.
/** @var \Drupal\Core\Config\StorageInterface $sync */
$sync = $this->container->get('config.storage.sync');
$data = $this->config('system.site')->get();
$data['slogan'] = 'in the face';
$this->copyConfig($this->container->get('config.storage'), $staging);
$staging->write('system.site', $data);
$this->copyConfig($this->container->get('config.storage'), $sync);
$sync->write('system.site', $data);
$this->drupalGet('admin/config/development/configuration');
$this->assertText(t('Warning message'));
$this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
......
......@@ -210,7 +210,7 @@ function testSerialization() {
);
// Encode and write, and reload and decode the configuration data.
$filestorage = new FileStorage($this->configDirectories[CONFIG_STAGING_DIRECTORY]);
$filestorage = new FileStorage($this->configDirectories[CONFIG_SYNC_DIRECTORY]);
$filestorage->write($name, $config_data);
$config_parsed = $filestorage->read($name);
......
......@@ -70,8 +70,8 @@ public function testInstallUninstall() {
$this->assertModuleTablesExist($module);
}
// Export active config to staging
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
// Export active config to sync.
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
system_list_reset();
$this->resetAll();
......@@ -145,7 +145,7 @@ public function testInstallUninstall() {
// Ensure that we have no configuration changes to import.
$storage_comparer = new StorageComparer(
$this->container->get('config.storage.staging'),
$this->container->get('config.storage.sync'),
$this->container->get('config.storage'),
$this->container->get('config.manager')
);
......
......@@ -42,7 +42,7 @@ protected function setUp() {
$this->webUser = $this->drupalCreateUser(array('synchronize configuration'));
$this->drupalLogin($this->webUser);
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
}
/**
......@@ -51,13 +51,13 @@ protected function setUp() {
* @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber
*/
public function testInstallProfileValidation() {
$staging = $this->container->get('config.storage.staging');
$this->copyConfig($this->container->get('config.storage'), $staging);
$core = $staging->read('core.extension');
$sync = $this->container->get('config.storage.sync');
$this->copyConfig($this->container->get('config.storage'), $sync);
$core = $sync->read('core.extension');
// Ensure install profiles can not be uninstalled.
unset($core['module']['testing_config_import']);
$staging->write('core.extension', $core);
$sync->write('core.extension', $core);
$this->drupalPostForm('admin/config/development/configuration', array(), t('Import all'));
$this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
......@@ -68,11 +68,11 @@ public function testInstallProfileValidation() {
unset($core['module']['syslog']);
unset($core['theme']['stark']);
$core['theme']['classy'] = 0;
$staging->write('core.extension', $core);
$staging->deleteAll('syslog.');
$theme = $staging->read('system.theme');
$sync->write('core.extension', $core);
$sync->deleteAll('syslog.');
$theme = $sync->read('system.theme');
$theme['default'] = 'classy';
$staging->write('system.theme', $theme);
$sync->write('system.theme', $theme);
$this->drupalPostForm('admin/config/development/configuration', array(), t('Import all'));
$this->assertText('The configuration was imported successfully.');
$this->rebuildContainer();
......
......@@ -40,11 +40,11 @@ protected function setUp() {
$this->installEntitySchema('node');
$this->installConfig(array('field', 'node'));
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
// Set up the ConfigImporter object for testing.
$storage_comparer = new StorageComparer(
$this->container->get('config.storage.staging'),
$this->container->get('config.storage.sync'),
$this->container->get('config.storage'),
$this->container->get('config.manager')
);
......@@ -71,11 +71,11 @@ public function testRecreateEntity() {
node_add_body_field($content_type);
/** @var \Drupal\Core\Config\StorageInterface $active */
$active = $this->container->get('config.storage');
/** @var \Drupal\Core\Config\StorageInterface $staging */
$staging = $this->container->get('config.storage.staging');
/** @var \Drupal\Core\Config\StorageInterface $sync */
$sync = $this->container->get('config.storage.sync');
$config_name = $content_type->getEntityType()->getConfigPrefix() . '.' . $content_type->id();
$this->copyConfig($active, $staging);
$this->copyConfig($active, $sync);
// Delete the content type. This will also delete a field storage, a field,
// an entity view display and an entity form display.
......
......@@ -48,7 +48,7 @@ protected function setUp() {
// Set up the ConfigImporter object for testing.
$storage_comparer = new StorageComparer(
$this->container->get('config.storage.staging'),
$this->container->get('config.storage.sync'),
$this->container->get('config.storage'),
$this->container->get('config.manager')
);
......@@ -80,8 +80,8 @@ public function testRenameValidation() {
// Stage the test entity and then delete it from the active storage.
$active = $this->container->get('config.storage');
$staging = $this->container->get('config.storage.staging');
$this->copyConfig($active, $staging);
$sync = $this->container->get('config.storage.sync');
$this->copyConfig($active, $sync);
$test_entity->delete();
// Create a content type with a matching UUID in the active storage.
......@@ -127,8 +127,8 @@ public function testRenameSimpleConfigValidation() {
$config->set('uuid', $uuid_value)->save();
$active = $this->container->get('config.storage');
$staging = $this->container->get('config.storage.staging');
$this->copyConfig($active, $staging);
$sync = $this->container->get('config.storage.sync');
$this->copyConfig($active, $sync);
$config->delete();
// Create another simple configuration with the same UUID.
......
......@@ -45,11 +45,11 @@ protected function setUp() {
// so it has to be cleared out manually.
unset($GLOBALS['hook_config_test']);
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
// Set up the ConfigImporter object for testing.
$storage_comparer = new StorageComparer(
$this->container->get('config.storage.staging'),
$this->container->get('config.storage.sync'),
$this->container->get('config.storage'),
$this->container->get('config.manager')
);
......@@ -75,10 +75,10 @@ protected function setUp() {
function testMissingContent() {
\Drupal::state()->set('config_import_test.config_import_missing_content', TRUE);
// Update a configuration entity in the staging directory to have a
// dependency on two content entities that do not exist.
// Update a configuration entity in the sync directory to have a dependency
// on two content entities that do not exist.
$storage = $this->container->get('config.storage');
$staging = $this->container->get('config.storage.staging');
$sync = $this->container->get('config.storage.sync');
$entity_one = entity_create('entity_test', array('name' => 'one'));
$entity_two = entity_create('entity_test', array('name' => 'two'));
$entity_three = entity_create('entity_test', array('name' => 'three'));
......@@ -93,7 +93,7 @@ function testMissingContent() {
// Entity three will be resolved by
// \Drupal\Core\Config\Importer\FinalMissingContentSubscriber.
$original_dynamic_data['dependencies']['content'][] = $entity_three->getConfigDependencyName();
$staging->write($dynamic_name, $original_dynamic_data);
$sync->write($dynamic_name, $original_dynamic_data);
// Import.
$this->configImporter->reset()->import();
......
......@@ -25,7 +25,7 @@ class ConfigOverrideTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
}
/**
......@@ -93,15 +93,15 @@ function testConfOverride() {
$this->assertIdentical($config->getOriginal('baz', FALSE), $expected_original_data['baz']);
$this->assertIdentical($config->getOriginal('404', FALSE), $expected_original_data['404']);
// Write file to staging.