Skip to content
Permalink
Browse files

Additional Test for ModelTask

  • Loading branch information...
markstory committed Apr 30, 2009
1 parent aad2bd7 commit 80287223f18b7963bbd2cec9d321222cc483c16c
Showing with 26 additions and 3 deletions.
  1. +6 −0 cake/console/libs/tasks/model.php
  2. +20 −3 cake/tests/cases/console/libs/tasks/model.test.php
@@ -53,6 +53,12 @@ class ModelTask extends Shell {
* @access public
*/
var $tasks = array('DbConfig', 'Fixture');
/**
* Holds tables found on connection.
*
* @var array
**/
var $__tables = array();
/**
* Execution method always used for tasks
*
@@ -100,7 +100,6 @@ function testListAll() {
function testGetName() {
$this->Task->setReturnValue('in', 1);
//test quit.
$this->Task->setReturnValueAt(0, 'in', 'q');
$this->Task->expectOnce('_stop');
$this->Task->getName('test_suite');
@@ -109,15 +108,33 @@ function testGetName() {
$result = $this->Task->getName('test_suite');
$expected = 'Article';
$this->assertEqual($result, $expected);
$this->Task->setReturnValueAt(2, 'in', 2);
$result = $this->Task->getName('test_suite');
$expected = 'Comment';
$this->assertEqual($result, $expected);
$this->Task->setReturnValueAt(3, 'in', 10);
$result = $this->Task->getName('test_suite');
$this->Task->expectOnce('err');
}
/**
* Test table name interactions
*
* @return void
**/
function testGetTableName() {
$this->Task->setReturnValueAt(0, 'in', 'y');
$result = $this->Task->getTable('Article', 'test_suite');
$expected = 'articles';
$this->assertEqual($result, $expected);
$this->Task->setReturnValueAt(1, 'in', 'n');
$this->Task->setReturnValueAt(2, 'in', 'my_table');
$result = $this->Task->getTable('Article', 'test_suite');
$expected = 'my_table';
$this->assertEqual($result, $expected);
}
}
?>

0 comments on commit 8028722

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