mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Updating FixtureTask and FixtureTask test to use TemplateTask
This commit is contained in:
parent
dff90e892e
commit
a38233e75d
2 changed files with 7 additions and 7 deletions
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue