Skip to content
Permalink
Browse files

Load cakephp-plugins when searching paths.

In test suites the plugins key is cleared, while the runtime loaded
plugins are not for compatibility reasons. This requires us to re-load
the configuration file to restore path information.

Refs #12288
  • Loading branch information...
markstory committed Jun 27, 2018
1 parent f8fb7b6 commit 703b4860b7f3b827e609bb59c16ff79860e1eb99
Showing with 24 additions and 0 deletions.
  1. +2 −0 src/Core/PluginCollection.php
  2. +22 −0 tests/TestCase/Core/PluginCollectionTest.php
@@ -109,6 +109,8 @@ protected function loadConfig()
*/
public function findPath($name)
{
$this->loadConfig();
$path = Configure::read('plugins.' . $name);
if ($path) {
return $path;
@@ -148,6 +148,28 @@ public function testFindPathNoConfigureData()
$this->assertEquals(TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS, $path);
}
public function testFindPathLoadsConfigureData()
{
$configPath = ROOT . DS . 'cakephp-plugins.php';
$this->skipIf(file_exists($configPath), 'cakephp-plugins.php exists, skipping overwrite');
$file = <<<PHP
<?php
return [
'plugins' => [
'TestPlugin' => '/config/path'
]
];
PHP;
file_put_contents($configPath, $file);
Configure::delete('plugins');
$plugins = new PluginCollection();
$path = $plugins->findPath('TestPlugin');
unlink($configPath);
$this->assertEquals('/config/path', $path);
}
public function testFindPathConfigureData()
{
Configure::write('plugins', ['TestPlugin' => '/some/path']);

0 comments on commit 703b486

Please sign in to comment.
You can’t perform that action at this time.