Skip to content
Snippets Groups Projects
Commit 38e36201 authored by jurgenhaas's avatar jurgenhaas
Browse files

Update patch and alpha tag for config_update

parent ba54b6b9
No related branches found
No related tags found
1 merge request!282Merging develop into main
Pipeline #1297179 passed
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"DDQG-unsupported-drupal-block_field-1.0.0.0-RC5", "DDQG-unsupported-drupal-block_field-1.0.0.0-RC5",
"DDQG-unsupported-drupal-commerce_xquantity-2.0.0.0-beta1", "DDQG-unsupported-drupal-commerce_xquantity-2.0.0.0-beta1",
"DDQG-unsupported-drupal-conditional_fields-4.0.0.0-alpha5", "DDQG-unsupported-drupal-conditional_fields-4.0.0.0-alpha5",
"DDQG-unsupported-drupal-config_update-2.0.0.0-alpha3", "DDQG-unsupported-drupal-config_update-2.0.0.0-alpha4",
"DDQG-unsupported-drupal-content_access-2.0.0.0", "DDQG-unsupported-drupal-content_access-2.0.0.0",
"DDQG-unsupported-drupal-custom_field-3.0.0.0-RC4", "DDQG-unsupported-drupal-custom_field-3.0.0.0-RC4",
"DDQG-unsupported-drupal-default_content-2.0.0.0-alpha2", "DDQG-unsupported-drupal-default_content-2.0.0.0-alpha2",
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
}, },
"drupal/config_update": { "drupal/config_update": {
"#3436790 Module weight": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3436790.diff?v=2", "#3436790 Module weight": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3436790.diff?v=2",
"#3056249 Core hash for localisation": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3056249.diff" "#3056249 Core hash for localisation": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3056249.diff?v=2"
}, },
"drupal/content_lock": { "drupal/content_lock": {
"#2951652 No content lock für CLI commands": "https://www.drupal.org/files/issues/2022-04-05/2951652-13.patch", "#2951652 No content lock für CLI commands": "https://www.drupal.org/files/issues/2022-04-05/2951652-13.patch",
......
diff --git a/config_update_ui/tests/src/Functional/ConfigUpdateTest.php b/config_update_ui/tests/src/Functional/ConfigUpdateTest.php
index 6e6b6738e6c6f96891b51479b768a7bce114d818..5155ac5d6ad414ce00e681a2be80d92e2055b89a 100644
--- a/config_update_ui/tests/src/Functional/ConfigUpdateTest.php
+++ b/config_update_ui/tests/src/Functional/ConfigUpdateTest.php
@@ -141,12 +141,6 @@ class ConfigUpdateTest extends BrowserTestBase {
$this->drupalGet('admin/config/development/configuration/report/type/search_page');
$this->assertReport('Search page', [], [], [], []);
- // Verify that after import, there is no config hash generated.
- $this->drupalGet('admin/config/development/configuration/single/export/search_page/user_search');
- $session = $this->assertSession();
- $session->pageTextContains('id: user_search');
- $session->pageTextNotContains('default_config_hash:');
-
// Edit the node search page from the search UI and verify report.
$this->drupalGet('admin/config/search/pages');
$this->clickLink('Edit');
diff --git a/src/ConfigReverter.php b/src/ConfigReverter.php diff --git a/src/ConfigReverter.php b/src/ConfigReverter.php
index 90d046b8bff50f6cac969a433604a6af79de4674..81395829023ae89f07a20b3cea7734ae8786e78f 100644 index 90d046b8bff50f6cac969a433604a6af79de4674..81395829023ae89f07a20b3cea7734ae8786e78f 100644
--- a/src/ConfigReverter.php --- a/src/ConfigReverter.php
+++ b/src/ConfigReverter.php +++ b/src/ConfigReverter.php
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
namespace Drupal\config_update; namespace Drupal\config_update;
+use Drupal\Component\Utility\Crypt; +use Drupal\Component\Utility\Crypt;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
@@ -108,11 +109,12 @@ class ConfigReverter implements ConfigRevertInterface, ConfigDeleteInterface { @@ -108,11 +109,12 @@ class ConfigReverter implements ConfigRevertInterface, ConfigDeleteInterface {
// Save it as a new config entity or simple config. // Save it as a new config entity or simple config.
if ($type === 'system.simple') { if ($type === 'system.simple') {
- $this->configFactory->getEditable($full_name)->setData($value)->save(); - $this->configFactory->getEditable($full_name)->setData($value)->save();
...@@ -40,7 +23,7 @@ index 90d046b8bff50f6cac969a433604a6af79de4674..81395829023ae89f07a20b3cea7734ae ...@@ -40,7 +23,7 @@ index 90d046b8bff50f6cac969a433604a6af79de4674..81395829023ae89f07a20b3cea7734ae
+ $entity->set('_core', ['default_config_hash' => Crypt::hashBase64(serialize($value))]); + $entity->set('_core', ['default_config_hash' => Crypt::hashBase64(serialize($value))]);
$entity->save(); $entity->save();
} }
@@ -156,10 +158,9 @@ class ConfigReverter implements ConfigRevertInterface, ConfigDeleteInterface { @@ -156,10 +158,9 @@ class ConfigReverter implements ConfigRevertInterface, ConfigDeleteInterface {
// hash (which is part of the _core config key's value). // hash (which is part of the _core config key's value).
if ($type === 'system.simple') { if ($type === 'system.simple') {
...@@ -63,204 +46,3 @@ index 90d046b8bff50f6cac969a433604a6af79de4674..81395829023ae89f07a20b3cea7734ae ...@@ -63,204 +46,3 @@ index 90d046b8bff50f6cac969a433604a6af79de4674..81395829023ae89f07a20b3cea7734ae
+ $entity->set('_core', ['default_config_hash' => Crypt::hashBase64(serialize($value))]); + $entity->set('_core', ['default_config_hash' => Crypt::hashBase64(serialize($value))]);
$entity->save(); $entity->save();
} }
diff --git a/tests/src/Unit/ConfigReverterTest.php b/tests/src/Unit/ConfigReverterTest.php
index 8b3e4aeee1523e1a908886d6a1bc39696e501656..d1bdfae097d6c8a52db7785992dd98e68dbe2e18 100644
--- a/tests/src/Unit/ConfigReverterTest.php
+++ b/tests/src/Unit/ConfigReverterTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\config_update\Unit;
+use Drupal\Component\Utility\Crypt;
use Drupal\config_update\ConfigReverter;
use Drupal\config_update\ConfigRevertInterface;
use Drupal\config_update\ConfigDeleteInterface;
@@ -135,45 +136,60 @@ class ConfigReverterTest extends ConfigUpdateUnitTestBase {
* Data provider for self:testImport().
*/
public function importProvider() {
+ $expected_values = [
+ 0 => [
+ 'in.extension' => 'extension',
+ ],
+ 1 => [
+ 'foo.bar.one' => 'extension',
+ 'id' => 'one',
+ ],
+ 2 => [
+ 'in.both' => 'extension',
+ ],
+ 3 => [
+ 'in.optional' => 'optional',
+ ],
+ ];
+ foreach ($expected_values as $i => $value) {
+ $expected_values[$i]['_core']['default_config_hash'] = Crypt::hashBase64(serialize($value));
+ }
+
return [
// Elements: type, name, config name, return value,
// config to set up before, config expected after. See also
// getFromExtensionProvider().
- [
+ 0 => [
'system.simple',
'in.extension',
'in.extension',
TRUE,
['in.extension' => 'before'],
- ['in.extension' => 'extension', '_core' => 'core_for_in.extension'],
+ $expected_values[0],
],
- [
+ 1 => [
'foo',
'one',
'foo.bar.one',
TRUE,
['foo.bar.one' => 'before', 'id' => 'one'],
- [
- 'foo.bar.one' => 'extension',
- 'id' => 'one',
- '_core' => 'core_for_foo.bar.one',
- ],
+ $expected_values[1],
],
- [
+ 2 => [
'system.simple',
'in.both',
'in.both',
TRUE,
['in.both' => 'before'],
- ['in.both' => 'extension', '_core' => 'core_for_in.both'],
+ $expected_values[2],
],
- [
+ 3 => [
'system.simple',
'in.optional',
'in.optional',
TRUE,
['in.optional' => 'before'],
- ['in.optional' => 'optional', '_core' => 'core_for_in.optional'],
+ $expected_values[3],
],
// Will be altered if the extension config exists.
[
@@ -197,7 +213,7 @@ class ConfigReverterTest extends ConfigUpdateUnitTestBase {
FALSE,
FALSE,
],
- [
+ 4 => [
'unknown',
'in.extension',
FALSE,
@@ -205,7 +221,7 @@ class ConfigReverterTest extends ConfigUpdateUnitTestBase {
FALSE,
FALSE,
],
- [
+ 5 => [
'system.simple',
'missing2',
'missing2',
@@ -250,6 +266,25 @@ class ConfigReverterTest extends ConfigUpdateUnitTestBase {
* Data provider for self:testRevert().
*/
public function revertProvider() {
+ $expected_values = [
+ 0 => [
+ 'in.extension' => 'extension',
+ ],
+ 1 => [
+ 'foo.bar.one' => 'extension',
+ 'id' => 'one',
+ ],
+ 2 => [
+ 'in.both' => 'extension',
+ ],
+ 3 => [
+ 'in.optional' => 'optional',
+ ],
+ ];
+ foreach ($expected_values as $i => $value) {
+ $expected_values[$i]['_core']['default_config_hash'] = Crypt::hashBase64(serialize($value));
+ }
+
return [
// Elements: type, name, config name, return value,
// config to set up before, config expected after. See also
@@ -282,43 +317,39 @@ class ConfigReverterTest extends ConfigUpdateUnitTestBase {
'_core' => 'core_for_foo.bar.pre_revert',
],
],
- [
+ 0 => [
'system.simple',
'in.extension',
'in.extension',
TRUE,
['in.extension' => 'active'],
- ['in.extension' => 'extension', '_core' => 'core_for_in.extension'],
+ $expected_values[0],
],
- [
+ 1 => [
'foo',
'one',
'foo.bar.one',
TRUE,
['foo.bar.one' => 'active', 'id' => 'one'],
- [
- 'foo.bar.one' => 'extension',
- 'id' => 'one',
- '_core' => 'core_for_foo.bar.one',
- ],
+ $expected_values[1],
],
- [
+ 2 => [
'system.simple',
'in.both',
'in.both',
TRUE,
['in.both' => 'active'],
- ['in.both' => 'extension', '_core' => 'core_for_in.both'],
+ $expected_values[2],
],
- [
+ 3 => [
'system.simple',
'in.optional',
'in.optional',
TRUE,
['in.optional' => 'active'],
- ['in.optional' => 'optional', '_core' => 'core_for_in.optional'],
+ $expected_values[3],
],
- [
+ 4 => [
'unknown',
'in.extension',
FALSE,
@@ -327,7 +358,7 @@ class ConfigReverterTest extends ConfigUpdateUnitTestBase {
FALSE,
],
// Missing from extension storage.
- [
+ 5 => [
'system.simple',
'missing2',
'missing2',
@@ -336,7 +367,7 @@ class ConfigReverterTest extends ConfigUpdateUnitTestBase {
FALSE,
],
// Present in extension storage but missing from active storage.
- [
+ 6 => [
'system.simple',
'another',
'another',
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
}, },
"drupal/config_update": { "drupal/config_update": {
"#3436790 Module weight": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3436790.diff?v=2", "#3436790 Module weight": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3436790.diff?v=2",
"#3056249 Core hash for localisation": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3056249.diff" "#3056249 Core hash for localisation": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3056249.diff?v=2"
}, },
"drupal/content_lock": { "drupal/content_lock": {
"#2951652 No content lock für CLI commands": "https://www.drupal.org/files/issues/2022-04-05/2951652-13.patch", "#2951652 No content lock für CLI commands": "https://www.drupal.org/files/issues/2022-04-05/2951652-13.patch",
......
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