From 0be1832cb81e443ab560bbb90293f8466f3ccb7b Mon Sep 17 00:00:00 2001 From: upchuk Date: Tue, 14 Aug 2018 13:06:16 +0200 Subject: [PATCH 1/2] GH-498 - Fixing ConfigContext backup strategy. --- src/Drupal/DrupalExtension/Context/ConfigContext.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Drupal/DrupalExtension/Context/ConfigContext.php b/src/Drupal/DrupalExtension/Context/ConfigContext.php index e858fee7..5e2eefe5 100644 --- a/src/Drupal/DrupalExtension/Context/ConfigContext.php +++ b/src/Drupal/DrupalExtension/Context/ConfigContext.php @@ -107,6 +107,13 @@ public function setConfig($name, $key, $value) { $backup = $this->getDriver()->configGet($name, $key); $this->getDriver()->configSet($name, $key, $value); - $this->config[$name][$key] = $backup; + if (!array_key_exists($name, $this->config)) { + $this->config[$name][$key] = $backup; + return; + } + + if (!array_key_exists($key, $this->config[$name])) { + $this->config[$name][$key] = $backup; + } } } From 245fec6b96c80ebbabf3dac32a1642c6b1842353 Mon Sep 17 00:00:00 2001 From: upchuk Date: Tue, 14 Aug 2018 13:14:39 +0200 Subject: [PATCH 2/2] GH-498: Fixing indentation issue. --- src/Drupal/DrupalExtension/Context/ConfigContext.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Drupal/DrupalExtension/Context/ConfigContext.php b/src/Drupal/DrupalExtension/Context/ConfigContext.php index 5e2eefe5..e302093e 100644 --- a/src/Drupal/DrupalExtension/Context/ConfigContext.php +++ b/src/Drupal/DrupalExtension/Context/ConfigContext.php @@ -108,12 +108,12 @@ public function setConfig($name, $key, $value) $backup = $this->getDriver()->configGet($name, $key); $this->getDriver()->configSet($name, $key, $value); if (!array_key_exists($name, $this->config)) { - $this->config[$name][$key] = $backup; - return; + $this->config[$name][$key] = $backup; + return; } if (!array_key_exists($key, $this->config[$name])) { - $this->config[$name][$key] = $backup; + $this->config[$name][$key] = $backup; } } }