/**
  * @param array $columnData
  * @return $this
  */
 private function addAutoIncrement(array $columnData)
 {
     if (true === array_key_exists('auto_increment', $columnData)) {
         $this->column->setAutoIncrement((bool) $columnData['auto_increment']);
     }
     return $this;
 }
 /**
  * @inheritdoc
  */
 protected function setColumns()
 {
     $statement = $this->connection->prepare('DESC ' . $this->table->getName());
     $statement->setFetchMode(\PDO::FETCH_ASSOC);
     $statement->execute();
     foreach ($statement as $item) {
         $column = new Column($item['Field']);
         $this->columns[] = $column->setAutoIncrement('auto_increment' === $item['Extra']);
     }
     return $this;
 }
 public function test()
 {
     $table = new Table('table_name');
     $column1 = new Column('id');
     $column1->setAutoIncrement(true);
     $column2 = new Column('name');
     $table->addColumn($column1)->addColumn($column2);
     $subject = new AutoIncrementTableColumnFinder();
     static::assertSame($column1->getName(), $subject->getAutoIncrementColumn($table)->getName());
     static::assertNull($subject->getAutoIncrementColumn(new Table('test_table')));
 }
 public function test()
 {
     $foreignKey = new ForeignKey();
     $foreignKey->setTableName('table1')->setColumnName('column1');
     $subject = new Column('name');
     $subject->setForeignKey($foreignKey)->setTable(new Table('test_table'));
     static::assertSame('name', $subject->getName());
     static::assertInstanceOf(ForeignKey::class, $subject->getForeignKey());
     $subject->removeForeignKey();
     static::assertSame(null, $subject->getForeignKey());
     static::assertFalse($subject->isAutoIncrement());
     $subject->setAutoIncrement(true);
     static::assertTrue($subject->isAutoIncrement());
     static::assertSame('test_table', $subject->getTable()->getName());
 }