From 59e306526f18da1e209e3c75347c1b96ba932b10 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 12 Sep 2011 23:20:29 -0400 Subject: [PATCH] Adding 'vendors' alias to App - Vendor is the new directory name, and a legacy mapping should exist. This makes App::path() match App::import() and all other packages. - Add an alias for plugins -> Plugin. It also was missing the alias, that matches the new style package names. Fixes #1972 --- lib/Cake/Core/App.php | 8 +++++--- lib/Cake/Test/Case/Core/AppTest.php | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 9a9f17887..b3d0aee84 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -166,7 +166,9 @@ class App { 'views' => 'View', 'helpers' => 'View/Helper', 'shells' => 'Console/Command', - 'libs' => 'Lib' + 'libs' => 'Lib', + 'vendors' => 'Vendor', + 'plugins' => 'Plugin', ); /** @@ -320,8 +322,8 @@ class App { '%s' . 'Locale' . DS, '%s' . 'locale' . DS ), - 'vendors' => array('%s' . 'Vendor' . DS, VENDORS), - 'plugins' => array( + 'Vendor' => array('%s' . 'Vendor' . DS, VENDORS), + 'Plugin' => array( APP . 'Plugin' . DS, APP . 'plugins' . DS, dirname(dirname(CAKE)) . DS . 'plugins' . DS, diff --git a/lib/Cake/Test/Case/Core/AppTest.php b/lib/Cake/Test/Case/Core/AppTest.php index 59a90edb5..c6462581a 100644 --- a/lib/Cake/Test/Case/Core/AppTest.php +++ b/lib/Cake/Test/Case/Core/AppTest.php @@ -183,6 +183,22 @@ class AppTest extends CakeTestCase { $this->assertEqual($old, $defaults); } +/** + * test path() with a plugin. + * + * @return void + */ + public function testPathWithPlugins() { + $basepath = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS; + App::build(array( + 'Plugin' => array($basepath), + )); + CakePlugin::load('TestPlugin'); + + $result = App::path('Vendor', 'TestPlugin'); + $this->assertEquals($basepath . 'TestPlugin' . DS . 'Vendor' . DS, $result[0]); + } + /** * testBuildWithReset method * @@ -757,7 +773,7 @@ class AppTest extends CakeTestCase { */ public function testPaths() { $result = App::paths(); - $this->assertArrayHasKey('plugins', $result); + $this->assertArrayHasKey('Plugin', $result); $this->assertArrayHasKey('Controller', $result); $this->assertArrayHasKey('Controller/Component', $result); }