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 * @var array
* @access public * @access public
*/ */
var $tasks = array('DbConfig', 'Model'); var $tasks = array('DbConfig', 'Model', 'Template');
/** /**
* path to fixtures directory * path to fixtures directory
* *
@ -219,11 +219,9 @@ class FixtureTask extends Shell {
} }
$filename = Inflector::underscore($model) . '_fixture.php'; $filename = Inflector::underscore($model) . '_fixture.php';
$Generator = new CodeGenerator(); $this->Template->set('model', $model);
$Generator->setPaths($this->Dispatch->shellPaths); $this->Template->set($vars);
$Generator->set('model', $model); $content = $this->Template->generate('objects', 'fixture');
$Generator->set($vars);
$content = $Generator->generate('objects', 'fixture');
$this->out("\nBaking test fixture for $model..."); $this->out("\nBaking test fixture for $model...");
$this->createFile($path . $filename, $content); $this->createFile($path . $filename, $content);

View file

@ -38,7 +38,7 @@ if (!class_exists('ShellDispatcher')) {
} }
if (!class_exists('FixtureTask')) { 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'; require CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'fixture.php';
} }
@ -80,7 +80,9 @@ class FixtureTaskTest extends CakeTestCase {
$this->Task =& new MockFixtureTask(); $this->Task =& new MockFixtureTask();
$this->Task->Model =& new MockFixtureModelTask(); $this->Task->Model =& new MockFixtureModelTask();
$this->Task->Dispatch = new $this->Dispatcher; $this->Task->Dispatch = new $this->Dispatcher;
$this->Task->Template =& new TemplateTask($this->Task->Dispatch);
$this->Task->Dispatch->shellPaths = Configure::read('shellPaths'); $this->Task->Dispatch->shellPaths = Configure::read('shellPaths');
$this->Task->Template->initialize();
} }
/** /**
* tearDown method * tearDown method