Skip to content
Permalink
Browse files

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
  • Loading branch information...
markstory committed Sep 13, 2011
1 parent d74f442 commit 59e306526f18da1e209e3c75347c1b96ba932b10
Showing with 22 additions and 4 deletions.
  1. +5 −3 lib/Cake/Core/App.php
  2. +17 −1 lib/Cake/Test/Case/Core/AppTest.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 @@ public static function build($paths = array(), $mode = App::PREPEND) {
'%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,
@@ -183,6 +183,22 @@ public function testCompatibleBuild() {
$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 @@ public function testClassLocation() {
*/
public function testPaths() {
$result = App::paths();
$this->assertArrayHasKey('plugins', $result);
$this->assertArrayHasKey('Plugin', $result);
$this->assertArrayHasKey('Controller', $result);
$this->assertArrayHasKey('Controller/Component', $result);
}

0 comments on commit 59e3065

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