Skip to content
Snippets Groups Projects
Commit 086d507d authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2261131 by Jose Reyero, Gábor Hojtsy | alexpott: Fixed Overrides will...

Issue #2261131 by Jose Reyero, Gábor Hojtsy | alexpott: Fixed Overrides will bleed in config export.
parent 34c6f669
No related branches found
No related tags found
No related merge requests found
......@@ -85,9 +85,11 @@ public function downloadExport() {
file_unmanaged_delete(file_directory_temp() . '/config.tar.gz');
$archiver = new ArchiveTar(file_directory_temp() . '/config.tar.gz', 'gz');
foreach ($this->targetStorage->listAll() as $name) {
$archiver->addString("$name.yml", Yaml::encode(\Drupal::config($name)->get()));
// Get raw configuration data without overrides.
foreach ($this->configManager->getConfigFactory()->listAll() as $name) {
$archiver->addString("$name.yml", Yaml::encode($this->configManager->getConfigFactory()->get($name)->getRawData()));
}
// Get all override data from the remaining collections.
foreach ($this->targetStorage->getAllCollectionNames() as $collection) {
$collection_storage = $this->targetStorage->createCollection($collection);
foreach ($collection_storage->listAll() as $name) {
......
......@@ -7,6 +7,7 @@
namespace Drupal\config\Tests;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Archiver\Tar;
use Drupal\simpletest\WebTestBase;
......@@ -20,7 +21,7 @@ class ConfigExportUITest extends WebTestBase {
*
* @var array
*/
public static $modules = array('config', 'config_test');
public static $modules = array('config', 'config_test', 'config_export_test');
public static function getInfo() {
return array(
......@@ -73,6 +74,13 @@ function testExport() {
// Assert that the downloaded archive file contents are the same as the test
// site active store.
$this->assertIdentical($archive_contents, $config_files);
// Ensure the test configuration override is in effect but was not exported.
$this->assertIdentical(\Drupal::config('system.maintenance')->get('message'), 'Foo');
$archiver->extract(file_directory_temp(), array('system.maintenance.yml'));
$file_contents = file_get_contents(file_directory_temp() . '/' . 'system.maintenance.yml');
$exported = Yaml::decode($file_contents);
$this->assertNotIdentical($exported['message'], 'Foo');
}
}
name: 'Configuration export test'
type: module
package: Testing
version: VERSION
core: 8.x
<?php
/**
* @file
* Provides config export testing support functionality.
*/
// Override the system maintenance message for testing.
$GLOBALS['config']['system.maintenance']['message'] = 'Foo';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment