Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding test cases for run create in Schema shell.

  • Loading branch information...
commit 74448e4deeee28d2cf9d0eee9f3ba8fbcab40be4 1 parent dd1075a
@markstory markstory authored
View
4 cake/console/libs/schema.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();
}
}
View
45 cake/tests/cases/console/libs/schema.test.php
@@ -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));
+ }
+
}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.