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
This commit is contained in:
mark_story 2011-09-12 23:20:29 -04:00
parent d74f442608
commit 59e306526f
2 changed files with 22 additions and 4 deletions

View file

@ -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,

View file

@ -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);
}