Skip to content

Commit

Permalink
Making -plugin function with ViewTask
Browse files Browse the repository at this point in the history
Adding tests for -plugin parameter
Removing extra Folder calls.
  • Loading branch information
markstory committed Jun 7, 2009
1 parent 4141158 commit 4d7f005
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
15 changes: 5 additions & 10 deletions cake/console/libs/tasks/view.php
Expand Up @@ -339,17 +339,12 @@ function bake($action, $content = '') {
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);
}

/**
Expand Down
16 changes: 16 additions & 0 deletions cake/tests/cases/console/libs/tasks/view.test.php
Expand Up @@ -176,6 +176,22 @@ function testBake() {
@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.
*
Expand Down

0 comments on commit 4d7f005

Please sign in to comment.