22
33namespace MongoDB \Laravel \Tests ;
44
5- use Illuminate \Database \Eloquent \Collection ;
5+ use Illuminate \Database \Eloquent \Collection as EloquentCollection ;
6+ use Illuminate \Support \Collection as LaravelCollection ;
67use Illuminate \Support \Facades \Schema ;
78use MongoDB \Builder \Search ;
89use MongoDB \Collection as MongoDBCollection ;
@@ -44,8 +45,8 @@ public function setUp(): void
4445 ]);
4546
4647 $ collection = $ this ->getConnection ('mongodb ' )->getCollection ('books ' );
47- 4848 assert ($ collection instanceof MongoDBCollection);
49+ 4950 try {
5051 $ collection ->createSearchIndex ([
5152 'mappings ' => [
@@ -143,7 +144,7 @@ public function testEloquentBuilderSearch()
143144 {
144145 $ results = Book::search (Search::text ('title ' , 'systems ' ));
145146
146- self ::assertInstanceOf (Collection ::class, $ results );
147+ self ::assertInstanceOf (EloquentCollection ::class, $ results );
147148 self ::assertCount (3 , $ results );
148149 self ::assertInstanceOf (Book::class, $ results ->first ());
149150 self ::assertSame ([
@@ -158,7 +159,7 @@ public function testDatabaseBuilderSearch()
158159 $ results = $ this ->getConnection ('mongodb ' )->table ('books ' )
159160 ->search (Search::text ('title ' , 'systems ' ));
160161
161- self ::assertInstanceOf (\ Illuminate \ Support \Collection ::class, $ results );
162+ self ::assertInstanceOf (LaravelCollection ::class, $ results );
162163 self ::assertCount (3 , $ results );
163164 self ::assertIsArray ($ results ->first ());
164165 self ::assertSame ([
@@ -172,7 +173,7 @@ public function testEloquentBuilderAutocomplete()
172173 {
173174 $ results = Book::autocomplete ('title ' , 'system ' );
174175
175- self ::assertInstanceOf (\ Illuminate \ Support \Collection ::class, $ results );
176+ self ::assertInstanceOf (LaravelCollection ::class, $ results );
176177 self ::assertCount (3 , $ results );
177178 self ::assertSame ([
178179 'Operating System Concepts ' ,
@@ -186,7 +187,7 @@ public function testDatabaseBuilderAutocomplete()
186187 $ results = $ this ->getConnection ('mongodb ' )->table ('books ' )
187188 ->autocomplete ('title ' , 'system ' );
188189
189- self ::assertInstanceOf (\ Illuminate \ Support \Collection ::class, $ results );
190+ self ::assertInstanceOf (LaravelCollection ::class, $ results );
190191 self ::assertCount (3 , $ results );
191192 self ::assertSame ([
192193 'Operating System Concepts ' ,
0 commit comments