Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding tests for interactive mode.

Fixing notice error.
  • Loading branch information...
commit 2cae04308cc0e7ec69e909d81bd27bed1ae4cdcc 1 parent 8bcd8ff
@markstory markstory authored
View
2  cake/console/libs/tasks/controller.php
@@ -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') {
View
24 cake/tests/cases/console/libs/tasks/controller.test.php
@@ -304,6 +304,7 @@ 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);
@@ -311,6 +312,29 @@ function testBakeActionsWithNoSessions() {
}
/**
+ * 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
*
* @return void
Please sign in to comment.
Something went wrong with that request. Please try again.