diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index 5104925c6..a0e63e8ea 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -1,27 +1,22 @@ in('Look okay?', array('y', 'n', 'q'), 'y'); - if (low($looksGood) == 'y') { + if (strtolower($looksGood) == 'y') { $verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n'); $Folder = new Folder($skel); @@ -155,14 +150,14 @@ class ProjectTask extends Shell { return false; } - if (low($verbose) == 'y') { + if (strtolower($verbose) == 'y') { foreach ($Folder->messages() as $message) { $this->out($message); } } return true; - } elseif (low($looksGood) == 'q') { + } elseif (strtolower($looksGood) == 'q') { $this->out('Bake Aborted.'); } else { $this->execute(false); diff --git a/cake/tests/cases/console/libs/tasks/plugin.test.php b/cake/tests/cases/console/libs/tasks/plugin.test.php index ee602757c..441aac2b5 100644 --- a/cake/tests/cases/console/libs/tasks/plugin.test.php +++ b/cake/tests/cases/console/libs/tasks/plugin.test.php @@ -69,7 +69,7 @@ class PluginTaskTest extends CakeTestCase { $this->Dispatcher->shellPaths = Configure::read('shellPaths'); $this->Task =& new MockPluginTask($this->Dispatcher); $this->Task->Dispatch =& $this->Dispatcher; - $this->Task->path = TMP; + $this->Task->path = TMP . 'tests' . DS; } /** @@ -79,7 +79,7 @@ class PluginTaskTest extends CakeTestCase { **/ function startCase() { $this->_paths = $paths = Configure::read('pluginPaths'); - $this->_testPath = array_push($paths, TMP); + $this->_testPath = array_push($paths, TMP . 'tests' . DS); Configure::write('pluginPaths', $paths); } @@ -112,7 +112,7 @@ class PluginTaskTest extends CakeTestCase { $this->Task->setReturnValueAt(1, 'in', 'y'); $this->Task->bake('BakeTestPlugin'); - $path = TMP . 'bake_test_plugin'; + $path = $this->Task->path . 'bake_test_plugin'; $this->assertTrue(is_dir($path), 'No plugin dir %s'); $this->assertTrue(is_dir($path . DS . 'controllers'), 'No controllers dir %s'); $this->assertTrue(is_dir($path . DS . 'controllers' . DS .'components'), 'No components dir %s'); @@ -130,7 +130,7 @@ class PluginTaskTest extends CakeTestCase { $file = $path . DS . 'bake_test_plugin_app_model.php'; $this->Task->expectAt(1, 'createFile', array($file, '*'), 'No AppModel %s'); - $Folder =& new Folder(TMP . 'bake_test_plugin'); + $Folder =& new Folder($this->Task->path . 'bake_test_plugin'); $Folder->delete(); } @@ -145,7 +145,7 @@ class PluginTaskTest extends CakeTestCase { $this->Task->Dispatch->args = array('BakeTestPlugin'); $this->Task->args =& $this->Task->Dispatch->args; - $path = TMP . 'bake_test_plugin'; + $path = $this->Task->path . 'bake_test_plugin'; $file = $path . DS . 'bake_test_plugin_app_controller.php'; $this->Task->expectAt(0, 'createFile', array($file, '*'), 'No AppController %s'); @@ -153,7 +153,7 @@ class PluginTaskTest extends CakeTestCase { $this->Task->expectAt(1, 'createFile', array($file, '*'), 'No AppModel %s'); $this->Task->execute(); - $Folder =& new Folder(TMP . 'bake_test_plugin'); + $Folder =& new Folder($this->Task->path . 'bake_test_plugin'); $Folder->delete(); } @@ -167,7 +167,7 @@ class PluginTaskTest extends CakeTestCase { $this->Task->setReturnValueAt(0, 'in', $this->_testPath); $this->Task->setReturnValueAt(1, 'in', 'y'); - $Folder =& new Folder(TMP . 'bake_test_plugin', true); + $Folder =& new Folder($this->Task->path . 'bake_test_plugin', true); $this->Task->Dispatch->args = array('BakeTestPlugin', 'model'); $this->Task->args =& $this->Task->Dispatch->args; diff --git a/cake/tests/cases/console/libs/tasks/project.test.php b/cake/tests/cases/console/libs/tasks/project.test.php index 28a81eed1..06886cf78 100644 --- a/cake/tests/cases/console/libs/tasks/project.test.php +++ b/cake/tests/cases/console/libs/tasks/project.test.php @@ -1,5 +1,4 @@ Dispatcher->shellPaths = Configure::read('shellPaths'); $this->Task =& new MockProjectTask($this->Dispatcher); $this->Task->Dispatch =& $this->Dispatcher; - $this->Task->path = TMP; + $this->Task->path = TMP . 'tests' . DS; } /** @@ -79,6 +78,32 @@ class ProjectTaskTest extends CakeTestCase { ClassRegistry::flush(); } +/** + * test bake() method and directory creation. + * + * @return void + **/ + function testBake() { + $skel = CAKE_CORE_INCLUDE_PATH . DS . CONSOLE_LIBS . 'templates' . DS . 'skel'; + $this->Task->setReturnValueAt(0, 'in', 'y'); + $this->Task->setReturnValueAt(1, 'in', 'n'); + $this->Task->bake($this->Task->path . 'bake_test_app', $skel); + + $path = $this->Task->path . 'bake_test_app'; + $this->assertTrue(is_dir($path), 'No project dir %s'); + $this->assertTrue(is_dir($path . DS . 'controllers'), 'No controllers dir %s'); + $this->assertTrue(is_dir($path . DS . 'controllers' . DS .'components'), 'No components dir %s'); + $this->assertTrue(is_dir($path . DS . 'models'), 'No models dir %s'); + $this->assertTrue(is_dir($path . DS . 'views'), 'No views dir %s'); + $this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir %s'); + $this->assertTrue(is_dir($path . DS . 'tests'), 'No tests dir %s'); + $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'cases'), 'No cases dir %s'); + $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'groups'), 'No groups dir %s'); + $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s'); + + $Folder =& new Folder($this->Task->path . 'bake_test_app'); + $Folder->delete(); + } } ?> \ No newline at end of file