Esempio n. 1
0
 public function testGetColumns()
 {
     // stub adapter
     $adapterStub = $this->getMock('\\Phinx\\Db\\Adapter\\MysqlAdapter', array(), array(array()));
     $adapterStub->expects($this->once())->method('getColumns');
     $table = new \Phinx\Db\Table('table1', array(), $adapterStub);
     $table->getColumns();
 }
 public function testIntegerColumnLimit()
 {
     $limit = 8;
     $table = new \Phinx\Db\Table('t', array(), $this->adapter);
     $table->addColumn('column1', 'integer', array('limit' => $limit))->save();
     $columns = $table->getColumns('t');
     $sqlType = $this->adapter->getSqlType($columns[1]->getType(), $columns[1]->getLimit());
     $this->assertEquals($limit, $sqlType['limit']);
 }
 public function testTinyIntegerColumn()
 {
     $table = new \Phinx\Db\Table('t', array(), $this->adapter);
     $table->addColumn('column1', 'integer', array('limit' => MysqlAdapter::INT_TINY))->save();
     $columns = $table->getColumns('t');
     $sqlType = $this->adapter->getSqlType($columns[1]->getType(), $columns[1]->getLimit());
     $this->assertEquals('tinyint', $sqlType['name']);
 }