public function testCreateTableWithNotAutoIncrementPrimaryKey()
 {
     $primaryKey = new PrimaryKey();
     $primaryKey->disableAutoIncrement();
     $table = new Table('foo');
     $table->addConstraint($primaryKey);
     $this->getCreateTableCommand()->setTable($table)->execute();
     $getTableCommand = new GetTableCommand();
     $getTableCommand->setConnection($this->connection);
     $getTableCommand->setTableName('foo');
     $tableInfo = $getTableCommand->execute();
     $this->assertEquals('integer', $tableInfo->getColumn('foo_id')->getType());
 }
Example #2
0
 public function testForeignKey()
 {
     $getTableCommand = new GetTableCommand();
     $getTableCommand->setConnection($this->connection);
     $getTableCommand->setTableName('foo');
     $table = $getTableCommand->execute();
     foreach ($table->getConstraints() as $constraint) {
         if ($constraint instanceof ForeignKey) {
             $this->assertInstanceOf('Rentgen\\Database\\Constraint\\ForeignKey', $constraint);
             $this->assertEquals('foo_bar_fkey', $constraint->getName());
         }
     }
 }