@@ -102,6 +102,36 @@ public function test_was_searchable_on_model_without_soft_deletes()
102
102
$ this ->assertTrue ($ model ->wasSearchableBeforeDelete ());
103
103
}
104
104
105
+ public function test_it_queries_searchable_models_by_their_ids_with_integer_key_type ()
106
+ {
107
+ $ model = M::mock (SearchableModel::class)->makePartial ();
108
+ $ model ->shouldReceive ('newQuery ' )->andReturnSelf ();
109
+ $ model ->shouldReceive ('getScoutKeyType ' )->andReturn ('int ' );
110
+ $ model ->shouldReceive ('getScoutKeyName ' )->andReturn ('id ' );
111
+ $ model ->shouldReceive ('qualifyColumn ' )->with ('id ' )->andReturn ('qualified_id ' );
112
+ $ model ->shouldReceive ('whereIntegerInRaw ' )->with ('qualified_id ' , [1 , 2 , 3 ])->andReturnSelf ();
113
+
114
+ $ scoutBuilder = M::mock (\Laravel \Scout \Builder::class);
115
+ $ scoutBuilder ->queryCallback = null ;
116
+
117
+ $ model ->queryScoutModelsByIds ($ scoutBuilder , [1 , 2 , 3 ]);
118
+ }
119
+
120
+ public function test_it_queries_searchable_models_by_their_ids_with_string_key_type ()
121
+ {
122
+ $ model = M::mock (SearchableModel::class)->makePartial ();
123
+ $ model ->shouldReceive ('newQuery ' )->andReturnSelf ();
124
+ $ model ->shouldReceive ('getScoutKeyType ' )->andReturn ('string ' );
125
+ $ model ->shouldReceive ('getScoutKeyName ' )->andReturn ('id ' );
126
+ $ model ->shouldReceive ('qualifyColumn ' )->with ('id ' )->andReturn ('qualified_id ' );
127
+ $ model ->shouldReceive ('whereIn ' )->with ('qualified_id ' , [1 , 2 , 3 ])->andReturnSelf ();
128
+
129
+ $ scoutBuilder = M::mock (\Laravel \Scout \Builder::class);
130
+ $ scoutBuilder ->queryCallback = null ;
131
+
132
+ $ model ->queryScoutModelsByIds ($ scoutBuilder , [1 , 2 , 3 ]);
133
+ }
134
+
105
135
public function test_was_searchable_before_update_works_from_true_to_false ()
106
136
{
107
137
$ model = new SearchableModelWithSoftDeletes ([
0 commit comments