mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Making -plugin function with ViewTask
Adding tests for -plugin parameter Removing extra Folder calls.
This commit is contained in:
parent
4141158f30
commit
4d7f00504a
2 changed files with 21 additions and 10 deletions
|
@ -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)) {
|
||||
$path = $this->path;
|
||||
if (isset($this->plugin)) {
|
||||
$path = $this->_pluginPath($this->plugin) . 'views' . DS;
|
||||
}
|
||||
$filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
|
||||
return $this->createFile($filename, $content);
|
||||
} else {
|
||||
foreach ($errors as $error) {
|
||||
$this->err($error);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue