Skip to content

Commit ca09b72

Browse files
authored
Merge pull request #802 from cakephp/fix-801
Preserve cache configuration better.
2 parents fb2d1a6 + 7a263e5 commit ca09b72

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Panel/CachePanel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public function initialize()
5656
} elseif (isset($config['className'])) {
5757
Cache::drop($name);
5858
$instance = new DebugEngine($config, $name, $this->logger);
59-
Cache::setConfig($name, $instance);
59+
$config['className'] = $instance;
60+
Cache::setConfig($name, $config);
6061
}
6162
if (isset($instance)) {
6263
$this->instances[$name] = $instance;

tests/TestCase/Panel/CachePanelTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function setUp(): void
3737
{
3838
parent::setUp();
3939
$this->panel = new CachePanel();
40-
Cache::setConfig('debug_kit_test', ['className' => 'Null']);
40+
Cache::setConfig('debug_kit_test', ['className' => 'Null', 'path' => TMP]);
4141
}
4242

4343
/**
@@ -110,4 +110,11 @@ public function testInitializeTwiceNoDoubleProxy()
110110
$result2 = Cache::engine('debug_kit_test');
111111
$this->assertSame($result2, $result);
112112
}
113+
114+
public function testInitializePreserveGlobalConfig()
115+
{
116+
$this->panel->initialize();
117+
$result = Cache::getConfig('debug_kit_test');
118+
$this->assertEquals($result['path'], TMP);
119+
}
113120
}

0 commit comments

Comments
 (0)