Making -plugin function with ViewTask

Adding tests for -plugin parameter
Removing extra Folder calls.
This commit is contained in:
mark_story 2009-06-06 21:18:34 -04:00
parent 4141158f30
commit 4d7f00504a
2 changed files with 21 additions and 10 deletions

View file

@ -339,17 +339,12 @@ class ViewTask extends Shell {
if ($content === true) {
$content = $this->getContent($action);
}
$filename = $this->path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
$Folder =& new Folder($this->path . $this->controllerPath, true);
$errors = $Folder->errors();
if (empty($errors)) {
return $this->createFile($filename, $content);
} else {
foreach ($errors as $error) {
$this->err($error);
}
$path = $this->path;
if (isset($this->plugin)) {
$path = $this->_pluginPath($this->plugin) . 'views' . DS;
}
return false;
$filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
return $this->createFile($filename, $content);
}
/**

View file

@ -176,6 +176,22 @@ class ViewTaskTest extends CakeTestCase {
@rmdir(TMP . 'view_task_comments');
}
/**
* test bake() with a -plugin param
*
* @return void
**/
function testBakeWithPlugin() {
$this->Task->path = TMP;
$this->Task->controllerName = 'ViewTaskComments';
$this->Task->controllerPath = 'view_task_comments';
$this->Task->plugin = 'TestTest';
$path = APP . 'plugins' . DS . 'test_test' . DS . 'views' . DS . 'view_task_comments' . DS . 'view.ctp';
$this->Task->expectAt(0, 'createFile', array($path, '*'));
$this->Task->bake('view', true);
}
/**
* test bake actions baking multiple actions.
*