From 3443e5162a1129f7a04af453b3eb3f267bc5a8a3 Mon Sep 17 00:00:00 2001 From: euromark Date: Sun, 28 Oct 2012 14:16:55 +0100 Subject: [PATCH] fix source of the path issues on windows --- lib/Cake/Core/App.php | 44 ++++++++++---------- lib/Cake/Test/TestCase/Core/AppTest.php | 48 +++++++++++----------- lib/Cake/Test/TestCase/Core/PluginTest.php | 8 ++-- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index be3b63bcd38..a46ea14b804 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.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 ) ); } diff --git a/lib/Cake/Test/TestCase/Core/AppTest.php b/lib/Cake/Test/TestCase/Core/AppTest.php index bc4629108d7..db3e831b1f1 100644 --- a/lib/Cake/Test/TestCase/Core/AppTest.php +++ b/lib/Cake/Test/TestCase/Core/AppTest.php @@ -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,7 +90,7 @@ public function testClassnameUnknownPlugin() { public function testBuild() { $old = App::path('Model'); $expected = array( - APP . 'Model/' + APP . 'Model' . DS ); $this->assertEquals($expected, $old); @@ -98,7 +98,7 @@ public function testBuild() { $new = App::path('Model'); $expected = array( '/path/to/models/', - APP . 'Model/' + APP . 'Model' . DS ); $this->assertEquals($expected, $new); @@ -107,7 +107,7 @@ public function testBuild() { $new = App::path('Model'); $expected = array( '/path/to/models/', - APP . 'Model/' + APP . 'Model' . DS ); $this->assertEquals($expected, $new); @@ -115,7 +115,7 @@ public function testBuild() { 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,7 +151,7 @@ public function testBuild() { public function testCompatibleBuild() { $old = App::path('Model'); $expected = array( - APP . 'Model/' + APP . 'Model' . DS ); $this->assertEquals($expected, $old); @@ -159,56 +159,56 @@ public function testCompatibleBuild() { $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(); diff --git a/lib/Cake/Test/TestCase/Core/PluginTest.php b/lib/Cake/Test/TestCase/Core/PluginTest.php index 6b5c7d684cf..741fd428e7f 100644 --- a/lib/Cake/Test/TestCase/Core/PluginTest.php +++ b/lib/Cake/Test/TestCase/Core/PluginTest.php @@ -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); }