Skip to content

Commit

Permalink
Merge pull request #802 from cakephp/fix-801
Browse files Browse the repository at this point in the history
Preserve cache configuration better.
  • Loading branch information
markstory authored Nov 27, 2020
2 parents fb2d1a6 + 7a263e5 commit ca09b72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Panel/CachePanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public function initialize()
} elseif (isset($config['className'])) {
Cache::drop($name);
$instance = new DebugEngine($config, $name, $this->logger);
Cache::setConfig($name, $instance);
$config['className'] = $instance;
Cache::setConfig($name, $config);
}
if (isset($instance)) {
$this->instances[$name] = $instance;
Expand Down
9 changes: 8 additions & 1 deletion tests/TestCase/Panel/CachePanelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function setUp(): void
{
parent::setUp();
$this->panel = new CachePanel();
Cache::setConfig('debug_kit_test', ['className' => 'Null']);
Cache::setConfig('debug_kit_test', ['className' => 'Null', 'path' => TMP]);
}

/**
Expand Down Expand Up @@ -110,4 +110,11 @@ public function testInitializeTwiceNoDoubleProxy()
$result2 = Cache::engine('debug_kit_test');
$this->assertSame($result2, $result);
}

public function testInitializePreserveGlobalConfig()
{
$this->panel->initialize();
$result = Cache::getConfig('debug_kit_test');
$this->assertEquals($result['path'], TMP);
}
}

0 comments on commit ca09b72

Please sign in to comment.