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
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -85,9 +85,11 @@ public function downloadExport() { ...@@ -85,9 +85,11 @@ public function downloadExport() {
file_unmanaged_delete(file_directory_temp() . '/config.tar.gz'); file_unmanaged_delete(file_directory_temp() . '/config.tar.gz');
$archiver = new ArchiveTar(file_directory_temp() . '/config.tar.gz', 'gz'); $archiver = new ArchiveTar(file_directory_temp() . '/config.tar.gz', 'gz');
foreach ($this->targetStorage->listAll() as $name) { // Get raw configuration data without overrides.
$archiver->addString("$name.yml", Yaml::encode(\Drupal::config($name)->get())); 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) { foreach ($this->targetStorage->getAllCollectionNames() as $collection) {
$collection_storage = $this->targetStorage->createCollection($collection); $collection_storage = $this->targetStorage->createCollection($collection);
foreach ($collection_storage->listAll() as $name) { foreach ($collection_storage->listAll() as $name) {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\config\Tests; namespace Drupal\config\Tests;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Archiver\Tar; use Drupal\Core\Archiver\Tar;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
...@@ -20,7 +21,7 @@ class ConfigExportUITest extends WebTestBase { ...@@ -20,7 +21,7 @@ class ConfigExportUITest extends WebTestBase {
* *
* @var array * @var array
*/ */
public static $modules = array('config', 'config_test'); public static $modules = array('config', 'config_test', 'config_export_test');
public static function getInfo() { public static function getInfo() {
return array( return array(
...@@ -73,6 +74,13 @@ function testExport() { ...@@ -73,6 +74,13 @@ function testExport() {
// Assert that the downloaded archive file contents are the same as the test // Assert that the downloaded archive file contents are the same as the test
// site active store. // site active store.
$this->assertIdentical($archive_contents, $config_files); $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.
Please to comment