mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding test cases for run create in Schema shell.
This commit is contained in:
parent
dd1075a330
commit
74448e4dee
2 changed files with 47 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Reference in a new issue