Skip to content
Permalink
Browse files

Adding test generation for controllers baked with ControllerTask::all()

  • Loading branch information...
markstory committed Jul 15, 2009
1 parent 80b9692 commit 1e8d01992ebb1f81bbc838f675730ae2211f8f5f
@@ -113,12 +113,15 @@ function all() {
$this->interactive = false;
$this->listAll($this->connection, false);
ClassRegistry::config('Model', array('ds' => $this->connection));
$unitTestExists = $this->_checkUnitTest();
foreach ($this->__tables as $table) {
$model = $this->_modelName($table);
$controller = $this->_controllerName($model);
if (App::import('Model', $model)) {
$actions = $this->bakeActions($controller);
$this->bake($controller, $actions);
if ($this->bake($controller, $actions) && $unitTestExists) {
$this->bakeTest($controller);
}
}
}
}
@@ -104,6 +104,7 @@ function startTest() {
$this->Task->Template->params['theme'] = 'default';
$this->Task->Model =& new ControllerMockModelTask($this->Task->Dispatch);
$this->Task->Project =& new ControllerMockProjectTask($this->Task->Dispatch);
$this->Task->Test =& new ControllerMockTestTask();
}
/**
@@ -368,7 +369,6 @@ function testBakeActionsWithNoSessions() {
function testBakeTest() {
$this->Task->plugin = 'ControllerTest';
$this->Task->connection = 'test_suite';
$this->Task->Test =& new ControllerMockTestTask();
$this->Task->Test->expectOnce('bake', array('Controller', 'Articles'));
$this->Task->bakeTest('Articles');
@@ -416,6 +416,10 @@ function testExecuteIntoAll() {
$this->Task->path = '/my/path/';
$this->Task->args = array('all');
$this->Task->setReturnValue('createFile', true);
$this->Task->setReturnValue('_checkUnitTest', true);
$this->Task->Test->expectCallCount('bake', 1);
$filename = '/my/path/articles_controller.php';
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticlesController/')));

0 comments on commit 1e8d019

Please sign in to comment.
You can’t perform that action at this time.