Exemplo n.º 1
0
 public function testNormalizeTable()
 {
     $column = new Column('price', 'DECIMAL');
     $column->getDomain()->copy($this->getPlatform()->getDomainForType('DECIMAL'));
     $column->setSize(10);
     $column->setScale(3);
     $table = new Table('prices');
     $table->addColumns([$column]);
     $this->getPlatform()->normalizeTable($table);
     $this->assertEquals("`price` DECIMAL(10,3)", $this->getPlatform()->getColumnDDL($column));
 }
Exemplo n.º 2
0
 public function testGetIndexDDLKeySize()
 {
     $table = new Table('foo');
     $table->setIdentifierQuoting(true);
     $column1 = new Column('bar1');
     $column1->getDomain()->copy($this->getPlatform()->getDomainForType('VARCHAR'));
     $column1->setSize(5);
     $table->addColumn($column1);
     $index = new Index('bar_index');
     $index->addColumn($column1);
     $table->addIndex($index);
     $expected = 'INDEX `bar_index` (`bar1`(5))';
     $this->assertEquals($expected, $this->getPlatform()->getIndexDDL($index));
 }
 public function testSetSize()
 {
     $domain = $this->getDomainMock();
     $domain->expects($this->once())->method('setSize')->with($this->equalTo(50));
     $domain->expects($this->once())->method('getSize')->will($this->returnValue(50));
     $column = new Column();
     $column->setDomain($domain);
     $column->setSize(50);
     $this->assertSame(50, $column->getSize());
 }