Updating FixtureTask and FixtureTask test to use TemplateTask

This commit is contained in:
mark_story 2009-05-12 21:26:37 -04:00
parent dff90e892e
commit a38233e75d
2 changed files with 7 additions and 7 deletions

View file

@ -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
*
@ -219,11 +219,9 @@ class FixtureTask extends Shell {
}
$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);

View file

@ -38,7 +38,7 @@ if (!class_exists('ShellDispatcher')) {
}
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';
}
@ -80,7 +80,9 @@ class FixtureTaskTest extends CakeTestCase {
$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