Skip to content

Commit

Permalink
fix source of the path issues on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Oct 28, 2012
1 parent 77afbec commit 3443e51
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 50 deletions.
44 changes: 22 additions & 22 deletions lib/Cake/Core/App.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
)
);
}
Expand Down
48 changes: 24 additions & 24 deletions lib/Cake/Test/TestCase/Core/AppTest.php
Expand Up @@ -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'));
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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'));

Expand All @@ -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(
Expand All @@ -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);
Expand All @@ -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]);
}

/**
Expand All @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Test/TestCase/Core/PluginTest.php
Expand Up @@ -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);
}
Expand All @@ -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'));
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 3443e51

Please sign in to comment.