3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 * This software consists of voluntary contributions made by many individuals
16 * and is licensed under the MIT license. For more information, see
17 * <http://www.doctrine-project.org>.
20 namespace Doctrine\Tests\DBAL\Schema;
22 require_once __DIR__ . '/../../TestInit.php';
24 use Doctrine\DBAL\Schema\Schema,
25 Doctrine\DBAL\Schema\SchemaConfig,
26 Doctrine\DBAL\Schema\Table,
27 Doctrine\DBAL\Schema\Column,
28 Doctrine\DBAL\Schema\Index,
29 Doctrine\DBAL\Schema\Sequence,
30 Doctrine\DBAL\Schema\SchemaDiff,
31 Doctrine\DBAL\Schema\TableDiff,
32 Doctrine\DBAL\Schema\Comparator,
33 Doctrine\DBAL\Types\Type,
34 Doctrine\DBAL\Schema\ForeignKeyConstraint;
37 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
38 * @link www.doctrine-project.org
39 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
40 * @license http://ez.no/licenses/new_bsd New BSD License
43 * @author Benjamin Eberlei <kontakt@beberlei.de>
45 class ComparatorTest extends \PHPUnit_Framework_TestCase
47 public function testCompareSame1()
49 $schema1 = new Schema( array(
50 'bugdb' => new Table('bugdb',
52 'integerfield1' => new Column('integerfield1', Type::getType('integer' ) ),
56 $schema2 = new Schema( array(
57 'bugdb' => new Table('bugdb',
59 'integerfield1' => new Column('integerfield1', Type::getType('integer') ),
64 $this->assertEquals(new SchemaDiff(), Comparator::compareSchemas( $schema1, $schema2 ) );
67 public function testCompareSame2()
69 $schema1 = new Schema( array(
70 'bugdb' => new Table('bugdb',
72 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
73 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
77 $schema2 = new Schema( array(
78 'bugdb' => new Table('bugdb',
80 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
81 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
85 $this->assertEquals(new SchemaDiff(), Comparator::compareSchemas( $schema1, $schema2 ) );
88 public function testCompareMissingTable()
90 $schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig;
91 $table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer'))));
92 $table->setSchemaConfig($schemaConfig);
94 $schema1 = new Schema( array($table), array(), $schemaConfig );
95 $schema2 = new Schema( array(), array(), $schemaConfig );
97 $expected = new SchemaDiff( array(), array(), array('bugdb' => $table) );
99 $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) );
102 public function testCompareNewTable()
104 $schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig;
105 $table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer'))));
106 $table->setSchemaConfig($schemaConfig);
108 $schema1 = new Schema( array(), array(), $schemaConfig );
109 $schema2 = new Schema( array($table), array(), $schemaConfig );
111 $expected = new SchemaDiff( array('bugdb' => $table), array(), array() );
112 $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) );
115 public function testCompareOnlyAutoincrementChanged()
117 $column1 = new Column('foo', Type::getType('integer'), array('autoincrement' => true));
118 $column2 = new Column('foo', Type::getType('integer'), array('autoincrement' => false));
120 $comparator = new Comparator();
121 $changedProperties = $comparator->diffColumn($column1, $column2);
123 $this->assertEquals(array('autoincrement'), $changedProperties);
126 public function testCompareMissingField()
128 $missingColumn = new Column('integerfield1', Type::getType('integer'));
129 $schema1 = new Schema( array(
130 'bugdb' => new Table('bugdb',
132 'integerfield1' => $missingColumn,
133 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
137 $schema2 = new Schema( array(
138 'bugdb' => new Table('bugdb',
140 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
145 $expected = new SchemaDiff ( array(),
147 'bugdb' => new TableDiff( 'bugdb', array(), array(),
149 'integerfield1' => $missingColumn,
154 $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) );
157 public function testCompareNewField()
159 $schema1 = new Schema( array(
160 'bugdb' => new Table('bugdb',
162 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
166 $schema2 = new Schema( array(
167 'bugdb' => new Table('bugdb',
169 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
170 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
175 $expected = new SchemaDiff ( array(),
177 'bugdb' => new TableDiff ('bugdb',
179 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
184 $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) );
187 public function testCompareChangedColumns_ChangeType()
189 $column1 = new Column('charfield1', Type::getType('string'));
190 $column2 = new Column('charfield1', Type::getType('integer'));
192 $c = new Comparator();
193 $this->assertEquals(array('type'), $c->diffColumn($column1, $column2));
194 $this->assertEquals(array(), $c->diffColumn($column1, $column1));
197 public function testCompareChangedColumns_ChangeCustomSchemaOption()
199 $column1 = new Column('charfield1', Type::getType('string'));
200 $column2 = new Column('charfield1', Type::getType('string'));
202 $column1->setCustomSchemaOption('foo', 'bar');
203 $column2->setCustomSchemaOption('foo', 'bar');
205 $column1->setCustomSchemaOption('foo1', 'bar1');
206 $column2->setCustomSchemaOption('foo2', 'bar2');
208 $c = new Comparator();
209 $this->assertEquals(array('foo1', 'foo2'), $c->diffColumn($column1, $column2));
210 $this->assertEquals(array(), $c->diffColumn($column1, $column1));
213 public function testCompareRemovedIndex()
215 $schema1 = new Schema( array(
216 'bugdb' => new Table('bugdb',
218 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
219 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
222 'primary' => new Index('primary',
231 $schema2 = new Schema( array(
232 'bugdb' => new Table('bugdb',
234 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
235 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
240 $expected = new SchemaDiff ( array(),
242 'bugdb' => new TableDiff( 'bugdb', array(), array(), array(), array(), array(),
244 'primary' => new Index('primary',
254 $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) );
257 public function testCompareNewIndex()
259 $schema1 = new Schema( array(
260 'bugdb' => new Table('bugdb',
262 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
263 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
267 $schema2 = new Schema( array(
268 'bugdb' => new Table('bugdb',
270 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
271 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
274 'primary' => new Index('primary',
284 $expected = new SchemaDiff ( array(),
286 'bugdb' => new TableDiff( 'bugdb', array(), array(), array(),
288 'primary' => new Index('primary',
298 $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) );
301 public function testCompareChangedIndex()
303 $schema1 = new Schema( array(
304 'bugdb' => new Table('bugdb',
306 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
307 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
310 'primary' => new Index('primary',
319 $schema2 = new Schema( array(
320 'bugdb' => new Table('bugdb',
322 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
323 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
326 'primary' => new Index('primary',
327 array('integerfield1', 'integerfield2'),
334 $expected = new SchemaDiff ( array(),
336 'bugdb' => new TableDiff( 'bugdb', array(), array(), array(), array(),
338 'primary' => new Index('primary',
349 $actual = Comparator::compareSchemas( $schema1, $schema2 );
350 $this->assertEquals($expected, $actual);
353 public function testCompareChangedIndexFieldPositions()
355 $schema1 = new Schema( array(
356 'bugdb' => new Table('bugdb',
358 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
359 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
362 'primary' => new Index('primary', array('integerfield1', 'integerfield2'), true)
366 $schema2 = new Schema( array(
367 'bugdb' => new Table('bugdb',
369 'integerfield1' => new Column('integerfield1', Type::getType('integer')),
370 'integerfield2' => new Column('integerfield2', Type::getType('integer')),
373 'primary' => new Index('primary', array('integerfield2', 'integerfield1'), true)
378 $expected = new SchemaDiff ( array(),
380 'bugdb' => new TableDiff('bugdb', array(), array(), array(), array(),
382 'primary' => new Index('primary', array('integerfield2', 'integerfield1'), true)
387 $actual = Comparator::compareSchemas( $schema1, $schema2 );
388 $this->assertEquals($expected, $actual);
391 public function testCompareSequences()
393 $seq1 = new Sequence('foo', 1, 1);
394 $seq2 = new Sequence('foo', 1, 2);
395 $seq3 = new Sequence('foo', 2, 1);
397 $c = new Comparator();
399 $this->assertTrue($c->diffSequence($seq1, $seq2));
400 $this->assertTrue($c->diffSequence($seq1, $seq3));
403 public function testRemovedSequence()
405 $schema1 = new Schema();
406 $seq = $schema1->createSequence('foo');
408 $schema2 = new Schema();
410 $c = new Comparator();
411 $diffSchema = $c->compare($schema1, $schema2);
413 $this->assertEquals(1, count($diffSchema->removedSequences));
414 $this->assertSame($seq, $diffSchema->removedSequences[0]);
417 public function testAddedSequence()
419 $schema1 = new Schema();
421 $schema2 = new Schema();
422 $seq = $schema2->createSequence('foo');
424 $c = new Comparator();
425 $diffSchema = $c->compare($schema1, $schema2);
427 $this->assertEquals(1, count($diffSchema->newSequences));
428 $this->assertSame($seq, $diffSchema->newSequences[0]);
431 public function testTableAddForeignKey()
433 $tableForeign = new Table("bar");
434 $tableForeign->addColumn('id', 'integer');
436 $table1 = new Table("foo");
437 $table1->addColumn('fk', 'integer');
439 $table2 = new Table("foo");
440 $table2->addColumn('fk', 'integer');
441 $table2->addForeignKeyConstraint($tableForeign, array('fk'), array('id'));
443 $c = new Comparator();
444 $tableDiff = $c->diffTable($table1, $table2);
446 $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
447 $this->assertEquals(1, count($tableDiff->addedForeignKeys));
450 public function testTableRemoveForeignKey()
452 $tableForeign = new Table("bar");
453 $tableForeign->addColumn('id', 'integer');
455 $table1 = new Table("foo");
456 $table1->addColumn('fk', 'integer');
458 $table2 = new Table("foo");
459 $table2->addColumn('fk', 'integer');
460 $table2->addForeignKeyConstraint($tableForeign, array('fk'), array('id'));
462 $c = new Comparator();
463 $tableDiff = $c->diffTable($table2, $table1);
465 $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
466 $this->assertEquals(1, count($tableDiff->removedForeignKeys));
469 public function testTableUpdateForeignKey()
471 $tableForeign = new Table("bar");
472 $tableForeign->addColumn('id', 'integer');
474 $table1 = new Table("foo");
475 $table1->addColumn('fk', 'integer');
476 $table1->addForeignKeyConstraint($tableForeign, array('fk'), array('id'));
478 $table2 = new Table("foo");
479 $table2->addColumn('fk', 'integer');
480 $table2->addForeignKeyConstraint($tableForeign, array('fk'), array('id'), array('onUpdate' => 'CASCADE'));
482 $c = new Comparator();
483 $tableDiff = $c->diffTable($table1, $table2);
485 $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
486 $this->assertEquals(1, count($tableDiff->changedForeignKeys));
489 public function testTablesCaseInsensitive()
491 $schemaA = new Schema();
492 $schemaA->createTable('foo');
493 $schemaA->createTable('bAr');
494 $schemaA->createTable('BAZ');
495 $schemaA->createTable('new');
497 $schemaB = new Schema();
498 $schemaB->createTable('FOO');
499 $schemaB->createTable('bar');
500 $schemaB->createTable('Baz');
501 $schemaB->createTable('old');
503 $c = new Comparator();
504 $diff = $c->compare($schemaA, $schemaB);
506 $this->assertSchemaTableChangeCount($diff, 1, 0, 1);
509 public function testSequencesCaseInsenstive()
511 $schemaA = new Schema();
512 $schemaA->createSequence('foo');
513 $schemaA->createSequence('BAR');
514 $schemaA->createSequence('Baz');
515 $schemaA->createSequence('new');
517 $schemaB = new Schema();
518 $schemaB->createSequence('FOO');
519 $schemaB->createSequence('Bar');
520 $schemaB->createSequence('baz');
521 $schemaB->createSequence('old');
523 $c = new Comparator();
524 $diff = $c->compare($schemaA, $schemaB);
526 $this->assertSchemaSequenceChangeCount($diff, 1, 0, 1);
529 public function testCompareColumnCompareCaseInsensitive()
531 $tableA = new Table("foo");
532 $tableA->addColumn('id', 'integer');
534 $tableB = new Table("foo");
535 $tableB->addColumn('ID', 'integer');
537 $c = new Comparator();
538 $tableDiff = $c->diffTable($tableA, $tableB);
540 $this->assertFalse($tableDiff);
543 public function testCompareIndexBasedOnPropertiesNotName()
545 $tableA = new Table("foo");
546 $tableA->addColumn('id', 'integer');
547 $tableA->addIndex(array("id"), "foo_bar_idx");
549 $tableB = new Table("foo");
550 $tableB->addColumn('ID', 'integer');
551 $tableB->addIndex(array("id"), "bar_foo_idx");
553 $c = new Comparator();
554 $tableDiff = $c->diffTable($tableA, $tableB);
556 $this->assertFalse($tableDiff);
559 public function testCompareForeignKeyBasedOnPropertiesNotName()
561 $tableA = new Table("foo");
562 $tableA->addColumn('id', 'integer');
563 $tableA->addNamedForeignKeyConstraint('foo_constraint', 'bar', array('id'), array('id'));
565 $tableB = new Table("foo");
566 $tableB->addColumn('ID', 'integer');
567 $tableB->addNamedForeignKeyConstraint('bar_constraint', 'bar', array('id'), array('id'));
569 $c = new Comparator();
570 $tableDiff = $c->diffTable($tableA, $tableB);
572 $this->assertFalse($tableDiff);
575 public function testCompareForeignKey_RestrictNoAction_AreTheSame()
577 $fk1 = new ForeignKeyConstraint(array("foo"), "bar", array("baz"), "fk1", array('onDelete' => 'NO ACTION'));
578 $fk2 = new ForeignKeyConstraint(array("foo"), "bar", array("baz"), "fk1", array('onDelete' => 'RESTRICT'));
580 $c = new Comparator();
581 $this->assertFalse($c->diffForeignKey($fk1, $fk2));
584 public function testDetectRenameColumn()
586 $tableA = new Table("foo");
587 $tableA->addColumn('foo', 'integer');
589 $tableB = new Table("foo");
590 $tableB->addColumn('bar', 'integer');
592 $c = new Comparator();
593 $tableDiff = $c->diffTable($tableA, $tableB);
595 $this->assertEquals(0, count($tableDiff->addedColumns));
596 $this->assertEquals(0, count($tableDiff->removedColumns));
597 $this->assertArrayHasKey('foo', $tableDiff->renamedColumns);
598 $this->assertEquals('bar', $tableDiff->renamedColumns['foo']->getName());
602 * You can easily have ambiguouties in the column renaming. If these
603 * are detected no renaming should take place, instead adding and dropping
604 * should be used exclusively.
608 public function testDetectRenameColumnAmbiguous()
610 $tableA = new Table("foo");
611 $tableA->addColumn('foo', 'integer');
612 $tableA->addColumn('bar', 'integer');
614 $tableB = new Table("foo");
615 $tableB->addColumn('baz', 'integer');
617 $c = new Comparator();
618 $tableDiff = $c->diffTable($tableA, $tableB);
620 $this->assertEquals(1, count($tableDiff->addedColumns), "'baz' should be added, not created through renaming!");
621 $this->assertArrayHasKey('baz', $tableDiff->addedColumns, "'baz' should be added, not created through renaming!");
622 $this->assertEquals(2, count($tableDiff->removedColumns), "'foo' and 'bar' should both be dropped, an ambigouty exists which one could be renamed to 'baz'.");
623 $this->assertArrayHasKey('foo', $tableDiff->removedColumns, "'foo' should be removed.");
624 $this->assertArrayHasKey('bar', $tableDiff->removedColumns, "'bar' should be removed.");
625 $this->assertEquals(0, count($tableDiff->renamedColumns), "no renamings should take place.");
628 public function testDetectChangeIdentifierType()
630 $this->markTestSkipped('DBAL-2 was reopened, this test cannot work anymore.');
632 $tableA = new Table("foo");
633 $tableA->addColumn('id', 'integer', array('autoincrement' => false));
635 $tableB = new Table("foo");
636 $tableB->addColumn('id', 'integer', array('autoincrement' => true));
638 $c = new Comparator();
639 $tableDiff = $c->diffTable($tableA, $tableB);
641 $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
642 $this->assertArrayHasKey('id', $tableDiff->changedColumns);
649 public function testDiff()
651 $table = new \Doctrine\DBAL\Schema\Table('twitter_users');
652 $table->addColumn('id', 'integer', array('autoincrement' => true));
653 $table->addColumn('twitterId', 'integer', array('nullable' => false));
654 $table->addColumn('displayName', 'string', array('nullable' => false));
655 $table->setPrimaryKey(array('id'));
657 $newtable = new \Doctrine\DBAL\Schema\Table('twitter_users');
658 $newtable->addColumn('id', 'integer', array('autoincrement' => true));
659 $newtable->addColumn('twitter_id', 'integer', array('nullable' => false));
660 $newtable->addColumn('display_name', 'string', array('nullable' => false));
661 $newtable->addColumn('logged_in_at', 'datetime', array('nullable' => true));
662 $newtable->setPrimaryKey(array('id'));
664 $c = new Comparator();
665 $tableDiff = $c->diffTable($table, $newtable);
667 $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
668 $this->assertEquals(array('twitterid', 'displayname'), array_keys($tableDiff->renamedColumns));
669 $this->assertEquals(array('logged_in_at'), array_keys($tableDiff->addedColumns));
670 $this->assertEquals(0, count($tableDiff->removedColumns));
677 public function testChangedSequence()
679 $schema = new Schema();
680 $sequence = $schema->createSequence('baz');
682 $schemaNew = clone $schema;
683 /* @var $schemaNew Schema */
684 $schemaNew->getSequence('baz')->setAllocationSize(20);
686 $c = new \Doctrine\DBAL\Schema\Comparator;
687 $diff = $c->compare($schema, $schemaNew);
689 $this->assertSame($diff->changedSequences[0] , $schemaNew->getSequence('baz'));
695 public function testDiffDecimalWithNullPrecision()
697 $column = new Column('foo', Type::getType('decimal'));
698 $column->setPrecision(null);
700 $column2 = new Column('foo', Type::getType('decimal'));
702 $c = new Comparator();
703 $this->assertEquals(array(), $c->diffColumn($column, $column2));
709 public function testFqnSchemaComparision()
711 $config = new SchemaConfig();
712 $config->setName("foo");
714 $oldSchema = new Schema(array(), array(), $config);
715 $oldSchema->createTable('bar');
717 $newSchema= new Schema(array(), array(), $config);
718 $newSchema->createTable('foo.bar');
720 $c = new Comparator();
721 $this->assertEquals(new SchemaDiff(), $c->compare($oldSchema, $newSchema));
727 public function testFqnSchemaComparisionDifferentSchemaNameButSameTableNoDiff()
729 $config = new SchemaConfig();
730 $config->setName("foo");
732 $oldSchema = new Schema(array(), array(), $config);
733 $oldSchema->createTable('foo.bar');
735 $newSchema = new Schema();
736 $newSchema->createTable('bar');
738 $c = new Comparator();
739 $diff = $c->compare($oldSchema, $newSchema);
740 $this->assertEquals(new SchemaDiff(), $c->compare($oldSchema, $newSchema));
746 public function testFqnSchemaComparisionNoSchemaSame()
748 $config = new SchemaConfig();
749 $config->setName("foo");
750 $oldSchema = new Schema(array(), array(), $config);
751 $oldSchema->createTable('bar');
753 $newSchema = new Schema();
754 $newSchema->createTable('bar');
756 $c = new Comparator();
757 $diff = $c->compare($oldSchema, $newSchema);
759 $this->assertEquals(new SchemaDiff(), $c->compare($oldSchema, $newSchema));
765 public function testAutoIncremenetSequences()
767 $oldSchema = new Schema();
768 $table = $oldSchema->createTable("foo");
769 $table->addColumn("id", "integer", array("autoincrement" => true));
770 $table->setPrimaryKey(array("id"));
771 $oldSchema->createSequence("foo_id_seq");
773 $newSchema = new Schema();
774 $table = $newSchema->createTable("foo");
775 $table->addColumn("id", "integer", array("autoincrement" => true));
776 $table->setPrimaryKey(array("id"));
778 $c = new Comparator();
779 $diff = $c->compare($oldSchema, $newSchema);
781 $this->assertCount(0, $diff->removedSequences);
785 * @param SchemaDiff $diff
786 * @param int $newTableCount
787 * @param int $changeTableCount
788 * @param int $removeTableCount
790 public function assertSchemaTableChangeCount($diff, $newTableCount=0, $changeTableCount=0, $removeTableCount=0)
792 $this->assertEquals($newTableCount, count($diff->newTables));
793 $this->assertEquals($changeTableCount, count($diff->changedTables));
794 $this->assertEquals($removeTableCount, count($diff->removedTables));
798 * @param SchemaDiff $diff
799 * @param int $newSequenceCount
800 * @param int $changeSequenceCount
801 * @param int $changeSequenceCount
803 public function assertSchemaSequenceChangeCount($diff, $newSequenceCount=0, $changeSequenceCount=0, $removeSequenceCount=0)
805 $this->assertEquals($newSequenceCount, count($diff->newSequences), "Expected number of new sequences is wrong.");
806 $this->assertEquals($changeSequenceCount, count($diff->changedSequences), "Expected number of changed sequences is wrong.");
807 $this->assertEquals($removeSequenceCount, count($diff->removedSequences), "Expected number of removed sequences is wrong.");