@@ -96,10 +96,11 @@ public function test_search()
96
96
$ table ->shouldReceive ('skip ' )->with ($ skip )->andReturnSelf ()
97
97
->shouldReceive ('limit ' )->with ($ limit )->andReturnSelf ()
98
98
->shouldReceive ('where ' )->with ('bar ' , 1 )->andReturnSelf ()
99
- ->shouldReceive ('where ' )->with ('baz ' , 'qux ' );
99
+ ->shouldReceive ('where ' )->with ('baz ' , 'qux ' )
100
+ ->shouldReceive ('getBindings ' )->andReturn ([null , 'foo ' , 1 , 'qux ' ]);
100
101
101
102
$ db ->shouldReceive ('select ' )
102
- ->with (null , [ null , ' foo ' , 1 , ' qux ' ] );
103
+ ->with (null , $ table -> getBindings () );
103
104
104
105
$ builder = new Builder (new TestModel (), 'foo ' );
105
106
$ builder ->where ('bar ' , 1 )
@@ -116,10 +117,11 @@ public function test_search_with_order_by()
116
117
$ table = $ this ->setDbExpectations ($ db , false );
117
118
118
119
$ table ->shouldReceive ('orderBy ' )->with ('bar ' , 'desc ' )->andReturnSelf ()
119
- ->shouldReceive ('orderBy ' )->with ('baz ' , 'asc ' )->andReturnSelf ();
120
+ ->shouldReceive ('orderBy ' )->with ('baz ' , 'asc ' )->andReturnSelf ()
121
+ ->shouldReceive ('getBindings ' )->andReturn ([null , 'foo ' ]);
120
122
121
123
$ db ->shouldReceive ('select ' )
122
- ->with (null , [ null , ' foo ' ] );
124
+ ->with (null , $ table -> getBindings () );
123
125
124
126
$ builder = new Builder (new TestModel (), 'foo ' );
125
127
$ builder ->orderBy ('bar ' , 'desc ' )
@@ -138,9 +140,10 @@ public function test_search_with_global_config()
138
140
139
141
$ table ->shouldReceive ('skip ' )->with ($ skip )->andReturnSelf ()
140
142
->shouldReceive ('limit ' )->with ($ limit )->andReturnSelf ()
141
- ->shouldReceive ('where ' )->with ('bar ' , 1 );
143
+ ->shouldReceive ('where ' )->with ('bar ' , 1 )
144
+ ->shouldReceive ('getBindings ' )->andReturn (['simple ' , 'foo ' , 1 ]);
142
145
143
- $ db ->shouldReceive ('select ' )->with (null , [ ' simple ' , ' foo ' , 1 ] );
146
+ $ db ->shouldReceive ('select ' )->with (null , $ table -> getBindings () );
144
147
145
148
$ builder = new Builder (new TestModel (), 'foo ' );
146
149
$ builder ->where ('bar ' , 1 )->take (5 );
@@ -158,9 +161,10 @@ public function test_search_with_model_config()
158
161
159
162
$ table ->shouldReceive ('skip ' )->with ($ skip )->andReturnSelf ()
160
163
->shouldReceive ('limit ' )->with ($ limit )->andReturnSelf ()
161
- ->shouldReceive ('where ' )->with ('bar ' , 1 );
164
+ ->shouldReceive ('where ' )->with ('bar ' , 1 )
165
+ ->shouldReceive ('getBindings ' )->andReturn (['english ' , 'foo ' , 1 ]);
162
166
163
- $ db ->shouldReceive ('select ' )->with (null , [ ' english ' , ' foo ' , 1 ] );
167
+ $ db ->shouldReceive ('select ' )->with (null , $ table -> getBindings () );
164
168
165
169
$ model = new TestModel ();
166
170
$ model ->searchableOptions ['config ' ] = 'english ' ;
@@ -180,9 +184,10 @@ public function test_search_with_soft_deletes()
180
184
$ table ->shouldReceive ('skip ' )->with (0 )->andReturnSelf ()
181
185
->shouldReceive ('limit ' )->with (5 )->andReturnSelf ()
182
186
->shouldReceive ('where ' )->with ('bar ' , 1 )->andReturnSelf ()
183
- ->shouldReceive ('whereNull ' )->with ('deleted_at ' );
187
+ ->shouldReceive ('whereNull ' )->with ('deleted_at ' )
188
+ ->shouldReceive ('getBindings ' )->andReturn ([null , 'foo ' , 1 ]);
184
189
185
- $ db ->shouldReceive ('select ' )->with (null , [ null , ' foo ' , 1 ] );
190
+ $ db ->shouldReceive ('select ' )->with (null , $ table -> getBindings () );
186
191
187
192
$ builder = new Builder (new SoftDeletableTestModel (), 'foo ' );
188
193
$ builder ->where ('bar ' , 1 )->take (5 );
@@ -240,7 +245,8 @@ public function test_map_ids_returns_right_key()
240
245
{
241
246
list ($ engine , $ db ) = $ this ->getEngine ();
242
247
243
- $ this ->setDbExpectations ($ db );
248
+ $ table = $ this ->setDbExpectations ($ db );
249
+ $ table ->shouldReceive ('getBindings ' )->andReturn ([null , 'foo ' ]);
244
250
245
251
$ db ->shouldReceive ('select ' )
246
252
->andReturn (json_decode ('[{"id": 1}, {"id": 2}] ' ));
@@ -275,6 +281,9 @@ protected function setDbExpectations($db, $withDefaultOrderBy = true)
275
281
$ table ->shouldReceive ('crossJoin ' )
276
282
->with ('plainto_tsquery(COALESCE(?, get_current_ts_config()), ?) AS "tsquery" ' )
277
283
->andReturnSelf ()
284
+ ->shouldReceive ('addBinding ' )
285
+ ->with (Mockery::type ('array ' ), 'join ' )
286
+ ->andReturnSelf ()
278
287
->shouldReceive ('select ' )
279
288
->with ('id ' )
280
289
->andReturnSelf ()
0 commit comments