Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 59e306526f18da1e209e3c75347c1b96ba932b10 1 parent d74f442
@markstory markstory authored
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
View
8 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 @@ 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,
View
18 lib/Cake/Test/Case/Core/AppTest.php
@@ -184,6 +184,22 @@ public function testCompatibleBuild() {
}
/**
+ * 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
*
* @return void
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.