Skip to content
This repository
Browse code

Adding test cases for run create in Schema shell.

  • Loading branch information...
commit 74448e4deeee28d2cf9d0eee9f3ba8fbcab40be4 1 parent dd1075a
Mark Story authored August 10, 2009
4  cake/console/libs/schema.php
@@ -122,7 +122,7 @@ function view() {
122 122
  * @access public
123 123
  */
124 124
 	function generate() {
125  
-		$this->out('Generating Schema...');
  125
+		$this->out(__('Generating Schema...', true));
126 126
 		$options = array();
127 127
 		if (isset($this->params['f'])) {
128 128
 			$options = array('models' => false);
@@ -280,7 +280,7 @@ function run() {
280 280
 			break;
281 281
 			default:
282 282
 				$this->err(__('Command not found', true));
283  
-			$this->_stop();
  283
+				$this->_stop();
284 284
 		}
285 285
 	}
286 286
 
45  cake/tests/cases/console/libs/schema.test.php
@@ -234,5 +234,50 @@ function testGenerateOverwrite() {
234 234
 		$this->Shell->generate();
235 235
 		unlink(TMP . 'schema.php');
236 236
 	}
  237
+
  238
+/**
  239
+ * Test schema run create with no table args.
  240
+ *
  241
+ * @return void
  242
+ **/
  243
+	function testRunCreateNoArgs() {
  244
+		$this->Shell->params = array(
  245
+			'connection' => 'test_suite',
  246
+			'name' => 'i18n',
  247
+			'path' => APP . 'config' . DS . 'schema'
  248
+		);
  249
+		$this->Shell->args = array('create');
  250
+		$this->Shell->startup();
  251
+		$this->Shell->setReturnValue('in', 'y');
  252
+		$this->Shell->run();
  253
+		
  254
+		$db =& ConnectionManager::getDataSource('test_suite');
  255
+		$sources = $db->listSources();
  256
+		$this->assertTrue(in_array('i18n', $sources));
  257
+	}
  258
+
  259
+/**
  260
+ * Test schema run create with no table args.
  261
+ *
  262
+ * @return void
  263
+ **/
  264
+	function testRunCreateWithTableArgs() {
  265
+		$this->Shell->params = array(
  266
+			'connection' => 'test_suite',
  267
+			'name' => 'DbAcl',
  268
+			'path' => APP . 'config' . DS . 'schema'
  269
+		);
  270
+		$this->Shell->args = array('create', 'acos');
  271
+		$this->Shell->startup();
  272
+		$this->Shell->setReturnValue('in', 'y');
  273
+		$this->Shell->run();
  274
+
  275
+		$db =& ConnectionManager::getDataSource('test_suite');
  276
+		$sources = $db->listSources();
  277
+		$this->assertTrue(in_array('acos', $sources));
  278
+		$this->assertFalse(in_array('aros', $sources));
  279
+		$this->assertFalse(in_array('aros_acos', $sources));
  280
+	}
  281
+
237 282
 }
238 283
 ?>

0 notes on commit 74448e4

Please sign in to comment.
Something went wrong with that request. Please try again.