@@ -29,25 +29,16 @@ public function testDeclareIndexes(): void
2929 {
3030 $ method = new Method ('up ' );
3131
32- $ schema = [
33- [
34- 'Non_unique ' => 1 , // 1 = обычный индекс, 0 = уникальный
35- 'Column_name ' => 'email ' ,
36- 'Collation ' => 'A ' , // 'A' = ASC, 'D' = DESC
37- ],
38- [
39- 'Non_unique ' => 0 , // уникальный индекс
40- 'Column_name ' => 'username ' ,
41- 'Collation ' => 'A ' , // сортировка по возрастанию
42- ],
43- ];
32+ $ columns = ['email ' , 'username ' ];
4433
45- $ indexA = MySQLIndex::createInstance ('table ' , 'idx_email_username ' , $ schema );
34+ $ indexA = new MySQLIndex ('table ' , 'idx_email_username ' );
35+ $ indexA ->columns ($ columns );
4636 $ initial = new State ('test_table ' );
4737 $ initial ->registerIndex ($ indexA );
4838
4939
50- $ indexB = MySQLIndex::createInstance ('table ' , 'idx_email_username ' , \array_reverse ($ schema ));
40+ $ indexB = new MySQLIndex ('table ' , 'idx_email_username ' );
41+ $ indexB ->columns (\array_reverse ($ columns ));
5142 $ current = new State ('test_table ' );
5243 $ current ->registerIndex ($ indexB );
5344
@@ -63,6 +54,6 @@ public function testDeclareIndexes(): void
6354 */
6455 $ reflectionMethod ->invoke ($ renderer , $ method , $ comparator );
6556
66- self ::assertSame ('1 ' , $ method ->getBody ());
57+ self ::assertSame ('' , $ method ->getBody ());
6758 }
6859}
0 commit comments