Skip to content

Commit

Permalink
Adding tests for __interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 15, 2009
1 parent ad930f2 commit 3051041
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/model.php
Expand Up @@ -217,7 +217,7 @@ function __interactive() {
$this->out("Name: " . $currentModelName);

if ($this->connection !== 'default') {
$this->out(sprintf(__("DB Config: %s", true), $useDbConfig));
$this->out(sprintf(__("DB Config: %s", true), $this->connection));
}
if ($fullTableName !== Inflector::tableize($currentModelName)) {
$this->out(sprintf(__("DB Table: %s", true), $fullTableName));
Expand Down
22 changes: 22 additions & 0 deletions cake/tests/cases/console/libs/tasks/model.test.php
Expand Up @@ -646,5 +646,27 @@ function testExecuteIntoAll() {

$this->Task->execute();
}

/**
* test the interactive side of bake.
*
* @return void
**/
function testExecuteIntoInteractive() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';

$this->Task->setReturnValueAt(0, 'in', '1'); //choose article
$this->Task->setReturnValueAt(1, 'in', 'n'); //no validation
$this->Task->setReturnValueAt(2, 'in', 'y'); //yes to associations
$this->Task->setReturnValueAt(3, 'in', 'y'); //yes to comment relation
$this->Task->setReturnValueAt(4, 'in', 'y'); //yes to user relation
$this->Task->setReturnValueAt(5, 'in', 'y'); //yes to tag relation
$this->Task->setReturnValueAt(6, 'in', 'n'); //no to looksGood?
$filename = '/my/path/article.php';
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class Article/')));
$this->Task->execute();
}
}
?>

0 comments on commit 3051041

Please sign in to comment.