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')));
 }
 /**
  * @throws \Exception
  */
 public function import()
 {
     $tables = $this->dataParser->getTables();
     $this->observer->setTables($tables);
     $autoIncrementEvent = new AutoIncrementChangeEvent();
     foreach ($tables as $table) {
         $autoIncrementEvent->setColumn($this->autoIncrementFinder->getAutoIncrementColumn($table));
         foreach ($table->getDataRows() as $dataRow) {
             $dataRowValues = [];
             foreach ($dataRow->getDataColumns() as $dataColumn) {
                 if (null !== $autoIncrementEvent->getColumn() && $autoIncrementEvent->getColumn()->getName() === $dataColumn->getName()) {
                     $autoIncrementEvent->setOldValue($dataColumn->getValue());
                     continue;
                 }
                 $dataRowValues[] = $dataColumn;
             }
             $lastInsertId = $this->insertRecord($table, $dataRowValues);
             if (null !== $autoIncrementEvent->getColumn()) {
                 $this->observer->notify($autoIncrementEvent->setNewValue($lastInsertId));
             }
         }
     }
 }