Skip to content
Permalink
Browse files

Adding tests for interactive mode.

Fixing notice error.
  • Loading branch information...
markstory committed May 19, 2009
1 parent 8bcd8ff commit 2cae04308cc0e7ec69e909d81bd27bed1ae4cdcc
Showing with 25 additions and 1 deletion.
  1. +1 −1 cake/console/libs/tasks/controller.php
  2. +24 −0 cake/tests/cases/console/libs/tasks/controller.test.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') {
@@ -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
*

0 comments on commit 2cae043

Please sign in to comment.
You can’t perform that action at this time.