Skip to content
Permalink
Browse files

fix source of the path issues on windows

  • Loading branch information...
dereuromark committed Oct 28, 2012
1 parent 77afbec commit 3443e5162a1129f7a04af453b3eb3f267bc5a8a3
Showing with 50 additions and 50 deletions.
  1. +22 −22 lib/Cake/Core/App.php
  2. +24 −24 lib/Cake/Test/TestCase/Core/AppTest.php
  3. +4 −4 lib/Cake/Test/TestCase/Core/PluginTest.php
@@ -355,7 +355,7 @@ public static function pluginPath($plugin) {
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::themePath
*/
public static function themePath($theme) {
$themeDir = 'Themed/' . Inflector::camelize($theme);
$themeDir = 'Themed' . DS . Inflector::camelize($theme);
foreach (static::$_packages['View'] as $path) {
if (is_dir($path . $themeDir)) {
return $path . $themeDir . DS;
@@ -500,7 +500,7 @@ public static function load($className) {
$paths[] = CAKE . $package . DS;
} else {
$pluginPath = static::pluginPath($plugin);
$paths[] = $pluginPath . 'Lib/' . $package . DS;
$paths[] = $pluginPath . 'Lib' . DS . $package . DS;
$paths[] = $pluginPath . $package . DS;
}
@@ -584,60 +584,60 @@ protected static function _packageFormat() {
if (empty(static::$_packageFormat)) {
static::$_packageFormat = array(
'Model' => array(
'%s' . 'Model/'
'%s' . 'Model' . DS
),
'Model/Behavior' => array(
'%s' . 'Model/Behavior/'
'%s' . 'Model' . DS . 'Behavior' . DS
),
'Model/Datasource' => array(
'%s' . 'Model/Datasource/'
'%s' . 'Model' . DS . 'Datasource' . DS
),
'Model/Datasource/Database' => array(
'%s' . 'Model/Datasource/Database/'
'%s' . 'Model' . DS . 'Datasource' . DS . 'Database' . DS
),
'Model/Datasource/Session' => array(
'%s' . 'Model/Datasource/Session/'
'%s' . 'Model' . DS . 'Datasource' . DS . 'Session' . DS
),
'Controller' => array(
'%s' . 'Controller/'
'%s' . 'Controller' . DS
),
'Controller/Component' => array(
'%s' . 'Controller/Component/'
'%s' . 'Controller' . DS . 'Component' . DS
),
'Controller/Component/Auth' => array(
'%s' . 'Controller/Component/Auth/'
'%s' . 'Controller' . DS . 'Component' . DS . 'Auth' . DS
),
'Controller/Component/Acl' => array(
'%s' . 'Controller/Component/Acl/'
'%s' . 'Controller' . DS . 'Component' . DS . 'Acl' . DS
),
'View' => array(
'%s' . 'View/'
'%s' . 'View' . DS
),
'View/Helper' => array(
'%s' . 'View/Helper/'
'%s' . 'View' . DS . 'Helper' . DS
),
'Console' => array(
'%s' . 'Console/'
'%s' . 'Console' . DS
),
'Console/Command' => array(
'%s' . 'Console/Command/'
'%s' . 'Console' . DS . 'Command' . DS
),
'Console/Command/Task' => array(
'%s' . 'Console/Command/Task/'
'%s' . 'Console' . DS . 'Command' . DS . 'Task' . DS
),
'Lib' => array(
'%s' . 'Lib/'
'%s' . 'Lib' . DS
),
'Locale' => array(
'%s' . 'Locale/'
'%s' . 'Locale' . DS
),
'Vendor' => array(
'%s' . 'Vendor/',
dirname(dirname(CAKE)) . DS . 'vendors/',
'%s' . 'Vendor' . DS,
dirname(dirname(CAKE)) . DS . 'vendors' . DS,
),
'Plugin' => array(
APP . 'Plugin/',
dirname(dirname(CAKE)) . DS . 'plugins/'
APP . 'Plugin' . DS,
dirname(dirname(CAKE)) . DS . 'plugins' . DS
)
);
}
@@ -62,7 +62,7 @@ public function testClassname() {
// Test plugin
App::build(array(
'Plugin' => array(CAKE . 'Test/TestApp/Plugin/')
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
), App::RESET);
Plugin::load('TestPlugin');
$this->assertEquals('TestPlugin\Utility\TestPluginEngine', App::classname('TestPlugin.TestPlugin', 'Utility', 'Engine'));
@@ -90,15 +90,15 @@ public function testClassnameUnknownPlugin() {
public function testBuild() {
$old = App::path('Model');
$expected = array(
APP . 'Model/'
APP . 'Model' . DS
);
$this->assertEquals($expected, $old);
App::build(array('Model' => array('/path/to/models/')));
$new = App::path('Model');
$expected = array(
'/path/to/models/',
APP . 'Model/'
APP . 'Model' . DS
);
$this->assertEquals($expected, $new);
@@ -107,15 +107,15 @@ public function testBuild() {
$new = App::path('Model');
$expected = array(
'/path/to/models/',
APP . 'Model/'
APP . 'Model' . DS
);
$this->assertEquals($expected, $new);
App::build();
App::build(array('Model' => array('/path/to/models/')), App::APPEND);
$new = App::path('Model');
$expected = array(
APP . 'Model/',
APP . 'Model' . DS,
'/path/to/models/'
);
$this->assertEquals($expected, $new);
@@ -127,13 +127,13 @@ public function testBuild() {
), App::APPEND);
$new = App::path('Model');
$expected = array(
APP . 'Model/',
APP . 'Model' . DS,
'/path/to/models/'
);
$this->assertEquals($expected, $new);
$new = App::path('Controller');
$expected = array(
APP . 'Controller/',
APP . 'Controller' . DS,
'/path/to/controllers/'
);
$this->assertEquals($expected, $new);
@@ -151,64 +151,64 @@ public function testBuild() {
public function testCompatibleBuild() {
$old = App::path('Model');
$expected = array(
APP . 'Model/'
APP . 'Model' . DS
);
$this->assertEquals($expected, $old);
App::build(array('Model' => array('/path/to/models/')));
$expected = array(
'/path/to/models/',
APP . 'Model/'
APP . 'Model' . DS
);
$this->assertEquals($expected, App::path('Model'));
App::build(array('Model/Datasource' => array('/path/to/datasources/')));
$expected = array(
'/path/to/datasources/',
APP . 'Model/Datasource/'
APP . 'Model' . DS . 'Datasource' . DS
);
$this->assertEquals($expected, App::path('Model/Datasource'));
App::build(array('Model/Behavior' => array('/path/to/behaviors/')));
$expected = array(
'/path/to/behaviors/',
APP . 'Model/Behavior/'
APP . 'Model' . DS . 'Behavior' . DS
);
$this->assertEquals($expected, App::path('Model/Behavior'));
App::build(array('Controller' => array('/path/to/controllers/')));
$expected = array(
'/path/to/controllers/',
APP . 'Controller/'
APP . 'Controller' . DS
);
$this->assertEquals($expected, App::path('Controller'));
App::build(array('Controller/Component' => array('/path/to/components/')));
$expected = array(
'/path/to/components/',
APP . 'Controller/Component/'
APP . 'Controller' . DS . 'Component' . DS
);
$this->assertEquals($expected, App::path('Controller/Component'));
App::build(array('View' => array('/path/to/views/')));
$expected = array(
'/path/to/views/',
APP . 'View/'
APP . 'View' . DS
);
$this->assertEquals($expected, App::path('View'));
App::build(array('View/Helper' => array('/path/to/helpers/')));
$expected = array(
'/path/to/helpers/',
APP . 'View/Helper/'
APP . 'View' . DS . 'Helper' . DS
);
$this->assertEquals($expected, App::path('View/Helper'));
App::build(array('Console/Command' => array('/path/to/shells/')));
$expected = array(
'/path/to/shells/',
APP . 'Console/Command/'
APP . 'Console' . DS . 'Command' . DS
);
$this->assertEquals($expected, App::path('Console/Command'));
@@ -225,8 +225,8 @@ public function testCompatibleBuild() {
public function testBuildPackage() {
$pluginPaths = array(
'/foo/bar',
APP . 'Plugin/',
dirname(dirname(CAKE)) . DS . 'plugins/'
APP . 'Plugin' . DS,
dirname(dirname(CAKE)) . DS . 'plugins' . DS
);
App::build(array(
'Plugin' => array(
@@ -241,12 +241,12 @@ public function testBuildPackage() {
App::build(array(
'Service' => array(
'%s' . 'Service/',
'%s' . 'Service' . DS
),
), App::REGISTER);
$expected = array(
APP . 'Service/',
APP . 'Service' . DS
);
$result = App::path('Service');
$this->assertEquals($expected, $result);
@@ -273,7 +273,7 @@ public function testPathWithPlugins() {
Plugin::load('TestPlugin');
$result = App::path('Vendor', 'TestPlugin');
$this->assertEquals($basepath . 'TestPlugin' . DS. 'Vendor' . '/', $result[0]);
$this->assertEquals($basepath . 'TestPlugin' . DS. 'Vendor' . DS, $result[0]);
}
/**
@@ -284,7 +284,7 @@ public function testPathWithPlugins() {
public function testBuildWithReset() {
$old = App::path('Model');
$expected = array(
APP . 'Model/'
APP . 'Model' . DS
);
$this->assertEquals($expected, $old);
@@ -466,11 +466,11 @@ public function testThemePath() {
'View' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'View' . DS)
));
$path = App::themePath('test_theme');
$expected = CAKE . 'Test' . DS . 'TestApp' . DS . 'View' . DS . 'Themed' . '/' . 'TestTheme' . DS;
$expected = CAKE . 'Test' . DS . 'TestApp' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS;
$this->assertEquals($expected, $path);
$path = App::themePath('TestTheme');
$expected = CAKE . 'Test' . DS . 'TestApp' . DS . 'View' . DS . 'Themed' . '/' . 'TestTheme' . DS;
$expected = CAKE . 'Test' . DS . 'TestApp' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS;
$this->assertEquals($expected, $path);
App::build();
@@ -33,7 +33,7 @@ class PluginTest extends TestCase {
public function setUp() {
parent::setUp();
App::build(array(
'Plugin' => array(CAKE . 'Test/TestApp/Plugin/')
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
), App::RESET);
App::objects('Plugin', null, false);
}
@@ -58,7 +58,7 @@ public function testGetNamespace() {
$this->assertEquals('TestPlugin', Plugin::getNamespace('TestPlugin'));
App::build(array(
'Plugin' => array(CAKE . 'Test/TestApp/Plugin2/')
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin2' . DS)
), App::RESET);
Plugin::load('TestPluginThree', array('namespace' => 'Company\TestPluginThree'));
@@ -218,10 +218,10 @@ public function testLoadNotFound() {
*/
public function testPath() {
Plugin::load(array('TestPlugin', 'TestPluginTwo'));
$expected = CAKE . 'Test/TestApp/Plugin/TestPlugin/';
$expected = CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS . 'TestPlugin' . DS;
$this->assertEquals(Plugin::path('TestPlugin'), $expected);
$expected = CAKE . 'Test/TestApp/Plugin/TestPluginTwo/';
$expected = CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS . 'TestPluginTwo' . DS;
$this->assertEquals(Plugin::path('TestPluginTwo'), $expected);
}

0 comments on commit 3443e51

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