public function testDropColumnInvalidColumnName() { $tbl = new Table("test_table", 'MyISAM'); $tbl->addColumn($this->getMock('Cytracom\\Squasher\\Database\\Column', [], ['string', 'myColumn'])); $cols = $tbl->getColumns(); $this->assertEquals(1, count($cols)); $tbl->dropColumn('bad column name'); $cols = $tbl->getColumns(); $this->assertEquals(1, count($cols)); }
/** * Create all of the column for the given table, and put nameless columns last (timestamps, softDeletes). */ protected function createColumns() { $doLater = []; foreach ($this->table->getColumns() as $column) { //if it is a generic column such as timestamps, soft deletes, etc; put at the end of the column list. if ($column->name === '' || $column->name === null || $column->name === $column->type) { array_push($doLater, $column); } else { $this->content .= $this->createColumn($column); } } foreach ($doLater as $column) { $column->name = null; $this->content .= $this->createColumn($column); } }