Adding tests for __interactive

This commit is contained in:
mark_story 2009-05-14 22:36:04 -04:00
parent ad930f277d
commit 305104140c
2 changed files with 23 additions and 1 deletions

View file

@ -217,7 +217,7 @@ class ModelTask extends Shell {
$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));

View file

@ -646,5 +646,27 @@ class ModelTaskTest extends CakeTestCase {
$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();
}
}
?>