77use Illuminate \Support \Facades \DB ;
88use Illuminate \Support \Facades \Schema ;
99use MongoDB \BSON \Binary ;
10- use MongoDB \BSON \Document ;
1110use MongoDB \BSON \UTCDateTime ;
1211use MongoDB \Collection ;
12+ use MongoDB \Database ;
1313use MongoDB \Laravel \Schema \Blueprint ;
1414
1515use function assert ;
@@ -20,8 +20,10 @@ class SchemaTest extends TestCase
2020{
2121 public function tearDown (): void
2222 {
23- Schema::drop ('newcollection ' );
24- Schema::drop ('newcollection_two ' );
23+ $ database = $ this ->getConnection ('mongodb ' )->getMongoDB ();
24+ assert ($ database instanceof Database);
25+ $ database ->dropCollection ('newcollection ' );
26+ $ database ->dropCollection ('newcollection_two ' );
2527 }
2628
2729 public function testCreate (): void
@@ -477,6 +479,7 @@ public function testGetColumns()
477479 $ this ->assertSame ([], $ columns );
478480 }
479481
482+ /** @see AtlasSearchTest::testGetIndexes() */
480483 public function testGetIndexes ()
481484 {
482485 Schema::create ('newcollection ' , function (Blueprint $ collection ) {
@@ -584,12 +587,12 @@ protected function getIndex(string $collection, string $name)
584587 return false ;
585588 }
586589
587- protected function getSearchIndex (string $ collection , string $ name ): ?Document
590+ protected function getSearchIndex (string $ collection , string $ name ): ?array
588591 {
589592 $ collection = DB ::getCollection ($ collection );
590593 assert ($ collection instanceof Collection);
591594
592- foreach ($ collection ->listSearchIndexes (['name ' => $ name , 'typeMap ' => ['root ' => 'bson ' ]]) as $ index ) {
595+ foreach ($ collection ->listSearchIndexes (['name ' => $ name , 'typeMap ' => ['root ' => 'array ' , ' array ' => ' array ' , ' document ' => ' array ' ]]) as $ index ) {
593596 return $ index ;
594597 }
595598
0 commit comments