Fixing some bake tasks

This commit is contained in:
Jose Lorenzo Rodriguez 2011-04-11 22:15:51 -04:30
parent 241a3bf624
commit 1bbdefc4ad
4 changed files with 37 additions and 38 deletions

View file

@ -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;
}

View file

@ -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.

View file

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

View file

@ -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.');
}