Skip to content
Permalink
Browse files

Adding test cases for run create in Schema shell.

  • Loading branch information...
markstory committed Aug 11, 2009
1 parent dd1075a commit 74448e4deeee28d2cf9d0eee9f3ba8fbcab40be4
Showing with 47 additions and 2 deletions.
  1. +2 −2 cake/console/libs/schema.php
  2. +45 −0 cake/tests/cases/console/libs/schema.test.php
@@ -122,7 +122,7 @@ function view() {
* @access public
*/
function generate() {
$this->out('Generating Schema...');
$this->out(__('Generating Schema...', true));
$options = array();
if (isset($this->params['f'])) {
$options = array('models' => false);
@@ -280,7 +280,7 @@ function run() {
break;
default:
$this->err(__('Command not found', true));
$this->_stop();
$this->_stop();
}
}
@@ -234,5 +234,50 @@ function testGenerateOverwrite() {
$this->Shell->generate();
unlink(TMP . 'schema.php');
}
/**
* Test schema run create with no table args.
*
* @return void
**/
function testRunCreateNoArgs() {
$this->Shell->params = array(
'connection' => 'test_suite',
'name' => 'i18n',
'path' => APP . 'config' . DS . 'schema'
);
$this->Shell->args = array('create');
$this->Shell->startup();
$this->Shell->setReturnValue('in', 'y');
$this->Shell->run();
$db =& ConnectionManager::getDataSource('test_suite');
$sources = $db->listSources();
$this->assertTrue(in_array('i18n', $sources));
}
/**
* Test schema run create with no table args.
*
* @return void
**/
function testRunCreateWithTableArgs() {
$this->Shell->params = array(
'connection' => 'test_suite',
'name' => 'DbAcl',
'path' => APP . 'config' . DS . 'schema'
);
$this->Shell->args = array('create', 'acos');
$this->Shell->startup();
$this->Shell->setReturnValue('in', 'y');
$this->Shell->run();
$db =& ConnectionManager::getDataSource('test_suite');
$sources = $db->listSources();
$this->assertTrue(in_array('acos', $sources));
$this->assertFalse(in_array('aros', $sources));
$this->assertFalse(in_array('aros_acos', $sources));
}
}
?>

0 comments on commit 74448e4

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