Skip to content

Commit

Permalink
Updating FixtureTask and FixtureTask test to use TemplateTask
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 13, 2009
1 parent dff90e8 commit a38233e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 4 additions & 6 deletions cake/console/libs/tasks/fixture.php
Expand Up @@ -42,7 +42,7 @@ class FixtureTask extends Shell {
* @var array
* @access public
*/
var $tasks = array('DbConfig', 'Model');
var $tasks = array('DbConfig', 'Model', 'Template');
/**
* path to fixtures directory
*
Expand Down Expand Up @@ -219,11 +219,9 @@ function generateFixtureFile($model, $otherVars) {
}
$filename = Inflector::underscore($model) . '_fixture.php';

$Generator = new CodeGenerator();
$Generator->setPaths($this->Dispatch->shellPaths);
$Generator->set('model', $model);
$Generator->set($vars);
$content = $Generator->generate('objects', 'fixture');
$this->Template->set('model', $model);
$this->Template->set($vars);
$content = $this->Template->generate('objects', 'fixture');

$this->out("\nBaking test fixture for $model...");
$this->createFile($path . $filename, $content);
Expand Down
4 changes: 3 additions & 1 deletion cake/tests/cases/console/libs/tasks/fixture.test.php
Expand Up @@ -38,7 +38,7 @@
}

if (!class_exists('FixtureTask')) {
require CAKE . 'console' . DS . 'libs' . DS . 'bake.php';
require CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php';
require CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'fixture.php';
}

Expand Down Expand Up @@ -80,7 +80,9 @@ function startTest() {
$this->Task =& new MockFixtureTask();
$this->Task->Model =& new MockFixtureModelTask();
$this->Task->Dispatch = new $this->Dispatcher;
$this->Task->Template =& new TemplateTask($this->Task->Dispatch);
$this->Task->Dispatch->shellPaths = Configure::read('shellPaths');
$this->Task->Template->initialize();
}
/**
* tearDown method
Expand Down

0 comments on commit a38233e

Please sign in to comment.