From 6c7a14e482b1dd70ba5ff3a75225e52d16627c41 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 30 Jan 2012 22:21:00 -0500 Subject: [PATCH] Adding fallback path to plugin. This matches the recent changes for the app dir. Adding tests for the plugin variant. --- lib/Cake/Core/App.php | 9 ++++++--- lib/Cake/Test/Case/Core/AppTest.php | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index d96f41829..b105b0633 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -229,7 +229,6 @@ class App { $path[] = sprintf($f, $pluginPath); } } - $path[] = $pluginPath . 'Lib' . DS . $type . DS; return $path; } @@ -540,8 +539,11 @@ class App { $paths[] = $appLibs . $package . DS; $paths[] = APP . $package . DS; $paths[] = CAKE . $package . DS; + } else { + $pluginPath = self::pluginPath($plugin); + $paths[] = $pluginPath . 'Lib' . DS . $package . DS; + $paths[] = $pluginPath . $package . DS; } - foreach ($paths as $path) { $file = $path . $className . '.php'; if (file_exists($file)) { @@ -857,7 +859,8 @@ class App { '%s' . 'Locale' . DS ), 'Vendor' => array( - '%s' . 'Vendor' . DS, VENDORS + '%s' . 'Vendor' . DS, + VENDORS ), 'Plugin' => array( APP . 'Plugin' . DS, diff --git a/lib/Cake/Test/Case/Core/AppTest.php b/lib/Cake/Test/Case/Core/AppTest.php index ed956d679..465717bf6 100644 --- a/lib/Cake/Test/Case/Core/AppTest.php +++ b/lib/Cake/Test/Case/Core/AppTest.php @@ -432,7 +432,7 @@ class AppTest extends CakeTestCase { } /** - * test that pluginPath can find paths for plugins. + * test that themePath can find paths for themes. * * @return void */ @@ -567,6 +567,9 @@ class AppTest extends CakeTestCase { $this->assertTrue($result); $this->assertTrue(class_exists('TestSource')); + App::uses('ExampleExample', 'TestPlugin.Vendor/Example'); + $this->assertTrue(class_exists('ExampleExample')); + App::build(); }