Skip to content

Commit

Permalink
Adding tests for interactive mode.
Browse files Browse the repository at this point in the history
Fixing notice error.
  • Loading branch information
markstory committed May 19, 2009
1 parent 8bcd8ff commit 2cae043
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function __interactive() {
}

if ($this->interactive === true) {
$this->confirmController($controllerName, $useDynamicScaffold, $uses, $helpers, $components);
$this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components);
$looksGood = $this->in(__('Look okay?', true), array('y','n'), 'y');

if (strtolower($looksGood) == 'y') {
Expand Down
24 changes: 24 additions & 0 deletions cake/tests/cases/console/libs/tasks/controller.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,36 @@ function testBakeActionsWithNoSessions() {

$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
$this->assertTrue(strpos($result, "\$this->Article->Tag->find('list')") !== false);
$this->assertTrue(strpos($result, "\$this->set(compact('tags'))") !== false);

$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
$this->assertTrue(strpos($result, 'if ($this->Article->del($id))') !== false);
$this->assertTrue(strpos($result, "\$this->flash(__('Article deleted', true), array('action'=>'index'))") !== false);
}

/**
* test Interactive mode.
*
* @return void
**/
function testInteractive() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path';
$this->Task->setReturnValueAt(0, 'in', '1');
$this->Task->setReturnValueAt(1, 'in', 'y'); // build interactive
$this->Task->setReturnValueAt(2, 'in', 'n'); // build no scaffolds
$this->Task->setReturnValueAt(3, 'in', 'y'); // build normal methods
$this->Task->setReturnValueAt(4, 'in', 'n'); // build admin methods
$this->Task->setReturnValueAt(5, 'in', 'n'); // helpers?
$this->Task->setReturnValueAt(6, 'in', 'n'); // components?
$this->Task->setReturnValueAt(7, 'in', 'y'); // use sessions
$this->Task->setReturnValueAt(8, 'in', 'y'); // looks good

$this->Task->execute();

$filename = '/my/path/articles_controller.php';
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticlesController/')));
}
/**
* test that execute runs all when the first arg == all
*
Expand Down

0 comments on commit 2cae043

Please sign in to comment.