From 830e8b29c08a759d38bcc1a9d2d65eb544a01da6 Mon Sep 17 00:00:00 2001 From: Davide Pastore Date: Sat, 26 Mar 2022 20:30:29 +0100 Subject: [PATCH] Fix merge Closed #145 --- src/AbstractConfig.php | 1 + tests/AbstractConfigTest.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/AbstractConfig.php b/src/AbstractConfig.php index 9a1aac0..5932eda 100644 --- a/src/AbstractConfig.php +++ b/src/AbstractConfig.php @@ -146,6 +146,7 @@ public function has($key) public function merge(ConfigInterface $config) { $this->data = array_replace_recursive($this->data, $config->all()); + $this->cache = []; return $this; } diff --git a/tests/AbstractConfigTest.php b/tests/AbstractConfigTest.php index 69dda1e..b782161 100644 --- a/tests/AbstractConfigTest.php +++ b/tests/AbstractConfigTest.php @@ -290,6 +290,8 @@ public function testMerge() ] ); + // Trigger the cache + $this->config->get('host'); $this->config->merge($remote); $this->assertEquals('127.0.0.1', $this->config['host']);