Commit 43530584 authored by Lee Davis's avatar Lee Davis Committed by Benjamin Eberlei

Add compare change columns test for multiple new columns rename

parent 9b35606f
...@@ -210,6 +210,26 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase ...@@ -210,6 +210,26 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(), $c->diffColumn($column1, $column1)); $this->assertEquals(array(), $c->diffColumn($column1, $column1));
} }
public function testCompareChangeColumns_MultipleNewColumnsRename()
{
$tableA = new Table("foo");
$tableA->addColumn('datefield1', 'datetime');
$tableB = new Table("foo");
$tableB->addColumn('new_datefield1', 'datetime');
$tableB->addColumn('new_datefield2', 'datetime');
$c = new Comparator();
$tableDiff = $c->diffTable($tableA, $tableB);
$this->assertEquals(1, count($tableDiff->renamedColumns), "we should have one rename datefield1 => new_datefield1.");
$this->assertArrayHasKey('datefield1', $tableDiff->renamedColumns, "'datefield1' should be set to be renamed to new_datefield1");
$this->assertEquals(1, count($tableDiff->addedColumns), "'new_datefield2' should be added");
$this->assertArrayHasKey('new_datefield2', $tableDiff->addedColumns, "'new_datefield2' should be added, not created through renaming!");
$this->assertEquals(0, count($tableDiff->removedColumns), "Nothing should be removed.");
$this->assertEquals(0, count($tableDiff->changedColumns), "Nothing should be changed as all fields old & new have diff names.");
}
public function testCompareRemovedIndex() public function testCompareRemovedIndex()
{ {
$schema1 = new Schema( array( $schema1 = new Schema( array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment