@@ -132,6 +132,34 @@ public function testDropIndex(): void
132132 $ index = $ this ->getIndex ('newcollection ' , 'field_a_1_field_b_1 ' );
133133 $ this ->assertFalse ($ index );
134134
135+ Schema::collection ('newcollection ' , function ($ collection ) {
136+ $ collection ->index (['field_a ' => -1 , 'field_b ' => 1 ]);
137+ });
138+
139+ $ index = $ this ->getIndex ('newcollection ' , 'field_a_-1_field_b_1 ' );
140+ $ this ->assertNotNull ($ index );
141+
142+ Schema::collection ('newcollection ' , function ($ collection ) {
143+ $ collection ->dropIndex (['field_a ' => -1 , 'field_b ' => 1 ]);
144+ });
145+
146+ $ index = $ this ->getIndex ('newcollection ' , 'field_a_-1_field_b_1 ' );
147+ $ this ->assertFalse ($ index );
148+
149+ Schema::collection ('newcollection ' , function ($ collection ) {
150+ $ collection ->index ([0 => 'field_a ' , 'field_b ' => -1 ]);
151+ });
152+
153+ $ index = $ this ->getIndex ('newcollection ' , 'field_a_1_field_b_-1 ' );
154+ $ this ->assertNotNull ($ index );
155+
156+ Schema::collection ('newcollection ' , function ($ collection ) {
157+ $ collection ->dropIndex ([0 => 'field_a ' , 'field_b ' => -1 ]);
158+ });
159+
160+ $ index = $ this ->getIndex ('newcollection ' , 'field_a_1_field_b_-1 ' );
161+ $ this ->assertFalse ($ index );
162+
135163 Schema::collection ('newcollection ' , function ($ collection ) {
136164 $ collection ->index (['field_a ' , 'field_b ' ], 'custom_index_name ' );
137165 });
0 commit comments