From 1bbdefc4ad46e86a0815648d69735a984e9dda98 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Mon, 11 Apr 2011 22:15:51 -0430 Subject: [PATCH] Fixing some bake tasks --- lib/Cake/Console/Command/Task/BakeTask.php | 2 +- lib/Cake/bootstrap.php | 10 ++-- .../Command/Task/ControllerTaskTest.php | 4 +- .../Console/Command/Task/ProjectTaskTest.php | 59 +++++++++---------- 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/lib/Cake/Console/Command/Task/BakeTask.php b/lib/Cake/Console/Command/Task/BakeTask.php index bd7f59e69..58fc783ef 100644 --- a/lib/Cake/Console/Command/Task/BakeTask.php +++ b/lib/Cake/Console/Command/Task/BakeTask.php @@ -50,7 +50,7 @@ class BakeTask extends Shell { public function getPath() { $path = $this->path; if (isset($this->plugin)) { - $path = $this->_pluginPath($this->plugin) . Inflector::pluralize(Inflector::underscore($this->name)) . DS; + $path = $this->_pluginPath($this->plugin) . $this->name . DS; } return $path; } diff --git a/lib/Cake/bootstrap.php b/lib/Cake/bootstrap.php index 0a5d3820f..6d4acee64 100644 --- a/lib/Cake/bootstrap.php +++ b/lib/Cake/bootstrap.php @@ -149,27 +149,27 @@ if (!defined('CAKE_TESTS')) { /** * Path to the controller test directory. */ - define('CONTROLLER_TESTS', TESTS.'cases'.DS.'controllers'.DS); + define('CONTROLLER_TESTS', TESTS.'Case'.DS.'Controller'.DS); /** * Path to the components test directory. */ - define('COMPONENT_TESTS', TESTS.'cases'.DS.'components'.DS); + define('COMPONENT_TESTS', TESTS.'Case'.DS.'Component'.DS); /** * Path to the helpers test directory. */ - define('HELPER_TESTS', TESTS.'cases'.DS.'views'.DS.'helpers'.DS); + define('HELPER_TESTS', TESTS.'Case'.DS.'View'.DS.'Helper'.DS); /** * Path to the models' test directory. */ - define('MODEL_TESTS', TESTS.'cases'.DS.'models'.DS); + define('MODEL_TESTS', TESTS.'Case'.DS.'Model'.DS); /** * Path to the lib test directory. */ - define('LIB_TESTS', CAKE_TESTS.'cases'.DS.'lib'.DS); + define('LIB_TESTS', CAKE_TESTS.'Case'.DS.'Lib'.DS); /** * Path to the temporary files directory. diff --git a/lib/Cake/tests/Case/Console/Command/Task/ControllerTaskTest.php b/lib/Cake/tests/Case/Console/Command/Task/ControllerTaskTest.php index aab40845a..a34b44397 100644 --- a/lib/Cake/tests/Case/Console/Command/Task/ControllerTaskTest.php +++ b/lib/Cake/tests/Case/Console/Command/Task/ControllerTaskTest.php @@ -299,7 +299,7 @@ class ControllerTaskTest extends CakeTestCase { $components = array('Acl', 'Auth'); $uses = array('Comment', 'User'); - $path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'ArticlesController.php'; + $path = APP . 'plugins' . DS . 'controller_test' . DS . 'Controller' . DS . 'ArticlesController.php'; $this->Task->expects($this->at(1))->method('createFile')->with( $path, @@ -313,7 +313,7 @@ class ControllerTaskTest extends CakeTestCase { $this->Task->bake('Articles', '--actions--', array(), array(), array()); $this->Task->plugin = 'controllerTest'; - $path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'ArticlesController.php'; + $path = APP . 'plugins' . DS . 'controller_test' . DS . 'Controller' . DS . 'ArticlesController.php'; $this->Task->bake('Articles', '--actions--', array(), array(), array()); $this->assertEqual($this->Task->Template->templateVars['plugin'], 'ControllerTest'); diff --git a/lib/Cake/tests/Case/Console/Command/Task/ProjectTaskTest.php b/lib/Cake/tests/Case/Console/Command/Task/ProjectTaskTest.php index 9816b145a..ebf29913b 100644 --- a/lib/Cake/tests/Case/Console/Command/Task/ProjectTaskTest.php +++ b/lib/Cake/tests/Case/Console/Command/Task/ProjectTaskTest.php @@ -88,18 +88,17 @@ class ProjectTaskTest extends CakeTestCase { $dirs = array( 'config', 'config' . DS . 'schema', - 'console', - 'console' . DS . 'shells', - 'console' . DS . 'shells' . DS . 'tasks', - 'controllers', - 'models', - 'views', - 'views' . DS . 'helpers', + 'Console', + 'Console' . DS . 'Command', + 'Console' . DS . 'Command' . DS . 'Task', + 'Controller', + 'Model', + 'View', + 'View' . DS . 'Helper', 'tests', - 'tests' . DS . 'cases', - 'tests' . DS . 'cases' . DS . 'models', - 'tests' . DS . 'cases', - 'tests' . DS . 'fixtures', + 'tests' . DS . 'Case', + 'tests' . DS . 'Case' . DS . 'Model', + 'tests' . DS . 'Fixture', 'tmp', 'webroot', 'webroot' . DS . 'js', @@ -121,16 +120,16 @@ class ProjectTaskTest extends CakeTestCase { $path = $this->Task->path . 'bake_test_app'; $empty = array( - 'console' . DS . 'shells' . DS . 'tasks', - 'controllers' . DS . 'components', - 'models' . DS . 'behaviors', - 'views' . DS . 'helpers', - 'views' . DS . 'errors', - 'views' . DS . 'scaffolds', - 'tests' . DS . 'cases' . DS . 'models', - 'tests' . DS . 'cases' . DS . 'controllers', - 'tests' . DS . 'cases' . DS . 'helpers', - 'tests' . DS . 'fixtures', + 'Console' . DS . 'Command' . DS . 'Task', + 'Controller' . DS . 'Component', + 'Model' . DS . 'Behavior', + 'View' . DS . 'Helper', + 'View' . DS . 'errors', + 'View' . DS . 'scaffolds', + 'tests' . DS . 'Case' . DS . 'Model', + 'tests' . DS . 'Case' . DS . 'Controller', + 'tests' . DS . 'Case' . DS . 'View' . DS . 'Helper', + 'tests' . DS . 'Fixture', 'webroot' . DS . 'js' ); @@ -256,7 +255,7 @@ class ProjectTaskTest extends CakeTestCase { * @return void */ public function testExecute() { - $this->Task->params['skel'] = CAKE . DS . 'console' . DS. 'templates' . DS . 'skel'; + $this->Task->params['skel'] = LIBS . 'Console' . DS. 'templates' . DS . 'skel'; $this->Task->params['working'] = TMP . 'tests' . DS; $path = $this->Task->path . 'bake_test_app'; @@ -265,14 +264,14 @@ class ProjectTaskTest extends CakeTestCase { $this->Task->execute(); $this->assertTrue(is_dir($path), 'No project dir'); - $this->assertTrue(is_dir($path . DS . 'controllers'), 'No controllers dir '); - $this->assertTrue(is_dir($path . DS . 'controllers' . DS .'components'), 'No components dir '); - $this->assertTrue(is_dir($path . DS . 'models'), 'No models dir'); - $this->assertTrue(is_dir($path . DS . 'views'), 'No views dir'); - $this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir'); + $this->assertTrue(is_dir($path . DS . 'Controller'), 'No controllers dir '); + $this->assertTrue(is_dir($path . DS . 'Controller' . DS .'Component'), 'No components dir '); + $this->assertTrue(is_dir($path . DS . 'Model'), 'No models dir'); + $this->assertTrue(is_dir($path . DS . 'View'), 'No views dir'); + $this->assertTrue(is_dir($path . DS . 'View' . DS . 'Helper'), 'No helpers dir'); $this->assertTrue(is_dir($path . DS . 'tests'), 'No tests dir'); - $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'cases'), 'No cases dir'); - $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir'); + $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'Case'), 'No cases dir'); + $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'Fixture'), 'No fixtures dir'); } /** @@ -287,7 +286,7 @@ class ProjectTaskTest extends CakeTestCase { $result = $this->Task->consolePath($path); $this->assertTrue($result); - $file = new File($path . 'console' . DS . 'cake.php'); + $file = new File($path . 'Console' . DS . 'cake.php'); $contents = $file->read(); $this->assertNoPattern('/__CAKE_PATH__/', $contents, 'Console path placeholder left behind.'); }