22
33namespace MongoDB \Laravel \Tests ;
44
5+ use Illuminate \Database \Eloquent \Collection as EloquentCollection ;
6+ use Illuminate \Support \Collection as LaravelCollection ;
57use MongoDB \Builder \Search ;
6- use MongoDB \Collection ;
8+ use MongoDB \Collection as MongoDBCollection ;
79use MongoDB \Driver \Exception \ServerException ;
810use MongoDB \Laravel \Tests \Models \Book ;
911
@@ -41,7 +43,7 @@ public function setUp(): void
4143 ]);
4244
4345 $ collection = $ this ->getConnection ('mongodb ' )->getCollection ('books ' );
44- assert ($ collection instanceof Collection );
46+ assert ($ collection instanceof MongoDBCollection );
4547 try {
4648 $ collection ->createSearchIndex ([
4749 'mappings ' => [
@@ -85,7 +87,7 @@ public function testEloquentBuilderSearch()
8587 {
8688 $ results = Book::search (Search::text ('title ' , 'systems ' ));
8789
88- self ::assertInstanceOf (\ Illuminate \ Database \ Eloquent \Collection ::class, $ results );
90+ self ::assertInstanceOf (EloquentCollection ::class, $ results );
8991 self ::assertCount (3 , $ results );
9092 self ::assertInstanceOf (Book::class, $ results ->first ());
9193 self ::assertSame ([
@@ -100,7 +102,7 @@ public function testDatabaseBuilderSearch()
100102 $ results = $ this ->getConnection ('mongodb ' )->table ('books ' )
101103 ->search (Search::text ('title ' , 'systems ' ));
102104
103- self ::assertInstanceOf (\ Illuminate \ Support \Collection ::class, $ results );
105+ self ::assertInstanceOf (LaravelCollection ::class, $ results );
104106 self ::assertCount (3 , $ results );
105107 self ::assertIsArray ($ results ->first ());
106108 self ::assertSame ([
@@ -114,7 +116,7 @@ public function testEloquentBuilderAutocomplete()
114116 {
115117 $ results = Book::autocomplete ('title ' , 'system ' );
116118
117- self ::assertInstanceOf (\ Illuminate \ Support \Collection ::class, $ results );
119+ self ::assertInstanceOf (LaravelCollection ::class, $ results );
118120 self ::assertCount (3 , $ results );
119121 self ::assertSame ([
120122 'Operating System Concepts ' ,
@@ -128,7 +130,7 @@ public function testDatabaseBuilderAutocomplete()
128130 $ results = $ this ->getConnection ('mongodb ' )->table ('books ' )
129131 ->autocomplete ('title ' , 'system ' );
130132
131- self ::assertInstanceOf (\ Illuminate \ Support \Collection ::class, $ results );
133+ self ::assertInstanceOf (LaravelCollection ::class, $ results );
132134 self ::assertCount (3 , $ results );
133135 self ::assertSame ([
134136 'Operating System Concepts ' ,
0 commit comments