File tree Expand file tree Collapse file tree 2 files changed +0
-39
lines changed Expand file tree Collapse file tree 2 files changed +0
-39
lines changed Original file line number Diff line number Diff line change 1313use Laravel \Scout \Engines \Engine ;
1414use Laravel \Scout \Searchable ;
1515use LogicException ;
16- use MongoDB \BSON \Regex ;
1716use MongoDB \BSON \Serializable ;
1817use MongoDB \BSON \UTCDateTime ;
1918use MongoDB \Collection as MongoDBCollection ;
4140use function is_iterable ;
4241use function is_string ;
4342use function iterator_to_array ;
44- use function preg_quote ;
4543use function sleep ;
4644use function sprintf ;
4745use function substr ;
@@ -428,22 +426,6 @@ public function deleteIndex($name): void
428426 $ this ->database ->selectCollection ($ name )->drop ();
429427 }
430428
431- /**
432- * Delete all "search indexes", i.e. all MongoDB collections.
433- */
434- public function deleteAllIndexes ()
435- {
436- $ collectionNames = $ this ->database ->listCollectionNames ([
437- 'filter ' => [
438- 'name ' => new Regex ('^ ' . preg_quote ($ this ->prefix )),
439- ],
440- ]);
441-
442- foreach ($ collectionNames as $ collectionName ) {
443- $ this ->database ->selectCollection ($ collectionName )->drop ();
444- }
445- }
446-
447429 /** Get the MongoDB collection used to search for the provided model */
448430 private function getSearchableCollection (Model |EloquentCollection $ model ): MongoDBCollection
449431 {
Original file line number Diff line number Diff line change 22
33namespace MongoDB \Laravel \Tests \Scout ;
44
5- use ArrayIterator ;
65use Closure ;
76use DateTimeImmutable ;
87use Illuminate \Database \Eloquent \Collection as EloquentCollection ;
1211use LogicException ;
1312use Mockery as m ;
1413use MongoDB \BSON \Document ;
15- use MongoDB \BSON \Regex ;
1614use MongoDB \BSON \UTCDateTime ;
1715use MongoDB \Collection ;
1816use MongoDB \Database ;
@@ -552,25 +550,6 @@ public function testDeleteWithRemoveableScoutCollection(): void
552550 $ engine ->delete ($ job ->models );
553551 }
554552
555- public function testDeleteAll (): void
556- {
557- $ collectionNames = ['scout-prefix-table1 ' , 'scout-prefix-table2 ' ];
558- $ database = m::mock (Database::class);
559- $ database ->shouldReceive ('listCollectionNames ' )
560- // Name prefix is escaped
561- ->with (['filter ' => ['name ' => new Regex ('^scout\-prefix\- ' )]])
562- ->andReturn (new ArrayIterator ($ collectionNames ));
563-
564- foreach ($ collectionNames as $ collectionName ) {
565- $ collection = m::mock (Collection::class);
566- $ database ->shouldReceive ('selectCollection ' )->with ($ collectionName )->andReturn ($ collection );
567- $ collection ->shouldReceive ('drop ' )->with ()->once ();
568- }
569-
570- $ engine = new ScoutEngine ($ database , softDelete: false , prefix: 'scout-prefix- ' );
571- $ engine ->deleteAllIndexes ();
572- }
573-
574553 public function testItCannotIndexInTheSameNamespace ()
575554 {
576555 self ::expectException (LogicException::class);
You can’t perform that action at this time.
0 commit comments