Skip to content

Commit

Permalink
Fix CS in generated migrations (remove trailing comma from drop_field…
Browse files Browse the repository at this point in the history
… array)
  • Loading branch information
Chris Burke committed Oct 16, 2014
1 parent c952119 commit abc4c92
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Console/Command/MigrationShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,10 @@ protected function _generateMigration($name, $class, $migration) {

$content .= "\t\t\t\t'" . $table . "' => array(";
if (!empty($fields)) {
$content .= "'" . implode("', '", $fields) . "', ";
$content .= "'" . implode("', '", $fields) . "'";
}
if (!empty($fields) && !empty($indexes)) {
$content .= ", ";
}
if (!empty($indexes)) {
$content .= "'indexes' => array('" . implode("', '", $indexes) . "')";
Expand Down
2 changes: 1 addition & 1 deletion Test/Case/Console/Command/MigrationShellTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ public function testGenerateComparison() {

$pattern = <<<TEXT
/ 'drop_field' => array\(
'articles' => array\('slug',\),
'articles' => array\('slug'\),
\),/
TEXT;
$this->assertRegExp(str_replace("\r\n", "\n", $pattern), $result);
Expand Down
2 changes: 1 addition & 1 deletion Test/Fixture/test_migration_add_fields_from_cli.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
),
'down' => array(
'drop_field' => array(
'products' => array('id', 'created', 'modified', 'name', 'description', 'in_stock', 'price', 'stock_count',),
'products' => array('id', 'created', 'modified', 'name', 'description', 'in_stock', 'price', 'stock_count'),
),
),
);
2 changes: 1 addition & 1 deletion Test/Fixture/test_migration_remove_fields_from_cli.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
public $migration = array(
'up' => array(
'drop_field' => array(
'products' => array('name', 'description',),
'products' => array('name', 'description'),
),
),
'down' => array(
Expand Down

0 comments on commit abc4c92

Please sign in to comment.