1010use Doctrine \DBAL \Schema \Comparator ;
1111use Doctrine \DBAL \Schema \Schema ;
1212use Doctrine \DBAL \Schema \SchemaDiff ;
13+ use Doctrine \DBAL \Schema \Sequence ;
1314use Doctrine \DBAL \Schema \Table ;
1415use Doctrine \Migrations \Generator \DiffGenerator ;
1516use Doctrine \Migrations \Generator \Generator ;
@@ -55,7 +56,7 @@ public function testGenerate(): void
5556 ->method ('getSchemaAssetsFilter ' )
5657 ->willReturn (
5758 static function ($ name ): bool {
58- return $ name === 'table_name1 ' ;
59+ return in_array ( $ name, [ 'table_name1 ' , ' table_name2_id_seq ' ], true ) ;
5960 },
6061 );
6162
@@ -74,10 +75,24 @@ static function ($name): bool {
7475 ->method ('getName ' )
7576 ->willReturn ('schema.table_name3 ' );
7677
78+ $ sequence1 = $ this ->createMock (Sequence::class);
79+ $ sequence1 ->expects (self ::once ())
80+ ->method ('getName ' )
81+ ->willReturn ('table_name1_id_seq ' );
82+
83+ $ sequence2 = $ this ->createMock (Sequence::class);
84+ $ sequence2 ->expects (self ::once ())
85+ ->method ('getName ' )
86+ ->willReturn ('table_name2_id_seq ' );
87+
7788 $ toSchema ->expects (self ::once ())
7889 ->method ('getTables ' )
7990 ->willReturn ([$ table1 , $ table2 , $ table3 ]);
8091
92+ $ toSchema ->expects (self ::once ())
93+ ->method ('getSequences ' )
94+ ->willReturn ([$ sequence1 , $ sequence2 ]);
95+
8196 $ this ->emptySchemaProvider ->expects (self ::never ())
8297 ->method ('createSchema ' );
8398
@@ -93,6 +108,10 @@ static function ($name): bool {
93108 ->method ('dropTable ' )
94109 ->willReturnOnConsecutiveCalls ('schema.table_name2 ' , 'schema.table_name3 ' );
95110
111+ $ toSchema ->expects (self ::once ())
112+ ->method ('dropSequence ' )
113+ ->with ('table_name1_id_seq ' );
114+
96115 $ schemaDiff = self ::createStub (SchemaDiff::class);
97116
98117 $ this ->platform ->method ('getAlterSchemaSQL ' )->willReturnCallback (static function (): array {
0 commit comments