Browse Source

Tweak templates and update tests.

mark_story 12 years ago
parent
commit
bc074652c1

+ 4 - 1
src/Console/Templates/default/classes/entity.ctp

@@ -32,7 +32,10 @@ $fields = array_map(function($el) { return "'$el'"; }, $fields);
  *
  * @var array
  */
-	protected $_accessible = [<?= implode(', ', $fields) ?>];
+	protected $_accessible = [
+		<?= implode(",\n\t\t", $fields) ?>
+
+	];
 
 <?php endif ?>
 }

+ 5 - 2
tests/TestCase/Console/Command/Task/ModelTaskTest.php

@@ -519,7 +519,7 @@ class ModelTaskTest extends TestCase {
 		$this->assertContains("this->displayField('title');\n", $result);
 		$this->assertContains("this->addBehavior('Timestamp');\n", $result);
 		$this->assertContains("this->table('articles');\n", $result);
-		$this->assertNotContains('use Cake\Validation\Validator;', $result);
+		$this->assertContains('use Cake\Validation\Validator;', $result);
 	}
 
 /**
@@ -595,7 +595,10 @@ class ModelTaskTest extends TestCase {
 		];
 		$model = TableRegistry::get('BakeArticles');
 		$result = $this->Task->bakeEntity($model, $config);
-		$this->assertContains("protected \$_accessible = ['title', 'body', 'published']", $result);
+		$this->assertContains("protected \$_accessible = [", $result);
+		$this->assertContains("'title',", $result);
+		$this->assertContains("'body',", $result);
+		$this->assertContains("'published'", $result);
 	}
 
 /**