Adding test cases for run create in Schema shell.

This commit is contained in:
mark_story 2009-08-10 21:54:29 -04:00
parent dd1075a330
commit 74448e4dee
2 changed files with 47 additions and 2 deletions

View file

@ -122,7 +122,7 @@ class SchemaShell extends Shell {
* @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 @@ class SchemaShell extends Shell {
break;
default:
$this->err(__('Command not found', true));
$this->_stop();
$this->_stop();
}
}

View file

@ -234,5 +234,50 @@ class SchemaShellTest extends CakeTestCase {
$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));
}
}
?>