Example #1
0
 public function testValidateReturnsTrueWhenTableHasNoPkButIsAView()
 {
     $table = new Table('foo');
     $table->setSkipSql(true);
     $appData = $this->getAppDataForTable($table);
     $validator = new SchemaValidator($appData);
     $this->assertTrue($validator->validate());
 }
 public function testSetSkipSql()
 {
     $table = new Table('books');
     $table->setSkipSql(true);
     $this->assertTrue($table->isSkipSql());
 }
 public function testCompareRemovedTableSkipSql()
 {
     $d1 = new Database();
     $t1 = new Table('Foo_Table');
     $c1 = new Column('Foo');
     $c1->getDomain()->copy($this->platform->getDomainForType('DOUBLE'));
     $c1->getDomain()->replaceScale(2);
     $c1->getDomain()->replaceSize(3);
     $c1->setNotNull(true);
     $c1->getDomain()->setDefaultValue(new ColumnDefaultValue(123, ColumnDefaultValue::TYPE_VALUE));
     $t1->addColumn($c1);
     $d1->addTable($t1);
     $t2 = new Table('Bar');
     $t2->setSkipSql(true);
     $d1->addTable($t2);
     $d2 = new Database();
     $t3 = new Table('Foo_Table');
     $c3 = new Column('Foo');
     $c3->getDomain()->copy($this->platform->getDomainForType('DOUBLE'));
     $c3->getDomain()->replaceScale(2);
     $c3->getDomain()->replaceSize(3);
     $c3->setNotNull(true);
     $c3->getDomain()->setDefaultValue(new ColumnDefaultValue(123, ColumnDefaultValue::TYPE_VALUE));
     $t3->addColumn($c3);
     $d2->addTable($t3);
     $dc = new DatabaseComparator();
     $dc->setFromDatabase($d1);
     $dc->setToDatabase($d2);
     $nbDiffs = $dc->compareTables();
     $databaseDiff = $dc->getDatabaseDiff();
     $this->assertEquals(0, $nbDiffs);
 }