7
7
use Illuminate \Support \Facades \DB ;
8
8
use Illuminate \Support \Facades \Schema ;
9
9
use MongoDB \BSON \Binary ;
10
- use MongoDB \BSON \Document ;
11
10
use MongoDB \BSON \UTCDateTime ;
12
11
use MongoDB \Collection ;
12
+ use MongoDB \Database ;
13
13
use MongoDB \Laravel \Schema \Blueprint ;
14
14
15
15
use function assert ;
@@ -20,8 +20,10 @@ class SchemaTest extends TestCase
20
20
{
21
21
public function tearDown (): void
22
22
{
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 ' );
25
27
}
26
28
27
29
public function testCreate (): void
@@ -477,6 +479,7 @@ public function testGetColumns()
477
479
$ this ->assertSame ([], $ columns );
478
480
}
479
481
482
+ /** @see AtlasSearchTest::testGetIndexes() */
480
483
public function testGetIndexes ()
481
484
{
482
485
Schema::create ('newcollection ' , function (Blueprint $ collection ) {
@@ -584,12 +587,12 @@ protected function getIndex(string $collection, string $name)
584
587
return false ;
585
588
}
586
589
587
- protected function getSearchIndex (string $ collection , string $ name ): ?Document
590
+ protected function getSearchIndex (string $ collection , string $ name ): ?array
588
591
{
589
592
$ collection = DB ::getCollection ($ collection );
590
593
assert ($ collection instanceof Collection);
591
594
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 ) {
593
596
return $ index ;
594
597
}
595
598
0 commit comments