Permalink
Browse files

Adding tests for __interactive

  • Loading branch information...
1 parent ad930f2 commit 305104140c5e3e265693ff8b99e17460eb906cfc @markstory markstory committed May 15, 2009
Showing with 23 additions and 1 deletion.
  1. +1 −1 cake/console/libs/tasks/model.php
  2. +22 −0 cake/tests/cases/console/libs/tasks/model.test.php
@@ -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));
@@ -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.