@@ -32,25 +32,25 @@ public function update_adds_object_to_index()
32
32
[$ engine , $ db ] = $ this ->getEngine ();
33
33
34
34
$ db ->shouldReceive ('query ' )
35
- ->andReturn ($ query = Mockery::mock ('stdClass ' ));
35
+ ->andReturn ($ query = Mockery::mock ('stdClass ' ))-> once () ;
36
36
$ query ->shouldReceive ('selectRaw ' )
37
37
->with (
38
38
'to_tsvector(COALESCE(?, get_current_ts_config()), ?) || setweight(to_tsvector(COALESCE(?, get_current_ts_config()), ?), ?) AS tsvector ' ,
39
39
[null , 'Foo ' , null , '' , 'B ' ]
40
40
)
41
- ->andReturnSelf ();
41
+ ->andReturnSelf ()-> once () ;
42
42
$ query ->shouldReceive ('value ' )
43
43
->with ('tsvector ' )
44
- ->andReturn ('foo ' );
44
+ ->andReturn ('foo ' )-> once () ;
45
45
46
46
$ db ->shouldReceive ('table ' )
47
47
->andReturn ($ table = Mockery::mock ('stdClass ' ));
48
48
$ table ->shouldReceive ('where ' )
49
49
->with ('id ' , '= ' , 1 )
50
- ->andReturnSelf ();
50
+ ->andReturnSelf ()-> once () ;
51
51
52
52
$ table ->shouldReceive ('update ' )
53
- ->with (['searchable ' => 'foo ' ]);
53
+ ->with (['searchable ' => 'foo ' ])-> once () ;
54
54
55
55
$ engine ->update (Collection::make ([new TestModel ]));
56
56
}
@@ -62,7 +62,7 @@ public function update_do_nothing_if_index_maintenance_turned_off_globally()
62
62
{
63
63
[$ engine ] = $ this ->getEngine (['maintain_index ' => false ]);
64
64
65
- $ engine ->update (Collection::make ([new TestModel ]));
65
+ $ this -> assertNull ( $ engine ->update (Collection::make ([new TestModel ]) ));
66
66
}
67
67
68
68
/**
@@ -73,12 +73,15 @@ public function delete_removes_object_from_index()
73
73
[$ engine , $ db ] = $ this ->getEngine ();
74
74
75
75
$ db ->shouldReceive ('table ' )
76
- ->andReturn ($ table = Mockery::mock ('stdClass ' ));
76
+ ->andReturn ($ table = Mockery::mock ('stdClass ' ))
77
+ ->once ();
77
78
$ table ->shouldReceive ('whereIn ' )
78
79
->with ('id ' , [1 ])
79
- ->andReturnSelf ();
80
+ ->andReturnSelf ()
81
+ ->once ();
80
82
$ table ->shouldReceive ('update ' )
81
- ->with (['searchable ' => null ]);
83
+ ->with (['searchable ' => null ])
84
+ ->once ();
82
85
83
86
$ engine ->delete (Collection::make ([new TestModel ]));
84
87
}
@@ -142,7 +145,8 @@ public function search()
142
145
->shouldReceive ('getBindings ' )->andReturn ([null , 'foo ' , 1 , 'qux ' ]);
143
146
144
147
$ db ->shouldReceive ('select ' )
145
- ->with (null , $ table ->getBindings ());
148
+ ->with (null , $ table ->getBindings ())
149
+ ->once ();
146
150
147
151
$ builder = new Builder (new TestModel , 'foo ' );
148
152
$ builder ->where ('bar ' , 1 )
@@ -166,7 +170,8 @@ public function search_with_order_by()
166
170
->shouldReceive ('getBindings ' )->andReturn ([null , 'foo ' ]);
167
171
168
172
$ db ->shouldReceive ('select ' )
169
- ->with (null , $ table ->getBindings ());
173
+ ->with (null , $ table ->getBindings ())
174
+ ->once ();
170
175
171
176
$ builder = new Builder (new TestModel , 'foo ' );
172
177
$ builder ->orderBy ('bar ' , 'desc ' )
@@ -191,7 +196,7 @@ public function search_with_global_config()
191
196
->shouldReceive ('where ' )->with ('bar ' , 1 )
192
197
->shouldReceive ('getBindings ' )->andReturn (['simple ' , 'foo ' , 1 ]);
193
198
194
- $ db ->shouldReceive ('select ' )->with (null , $ table ->getBindings ());
199
+ $ db ->shouldReceive ('select ' )->with (null , $ table ->getBindings ())-> once () ;
195
200
196
201
$ builder = new Builder (new TestModel , 'foo ' );
197
202
$ builder ->where ('bar ' , 1 )->take (5 );
@@ -215,7 +220,7 @@ public function search_with_model_config()
215
220
->shouldReceive ('where ' )->with ('bar ' , 1 )
216
221
->shouldReceive ('getBindings ' )->andReturn (['english ' , 'foo ' , 1 ]);
217
222
218
- $ db ->shouldReceive ('select ' )->with (null , $ table ->getBindings ());
223
+ $ db ->shouldReceive ('select ' )->with (null , $ table ->getBindings ())-> once () ;
219
224
220
225
$ model = new TestModel ;
221
226
$ model ->searchableOptions ['config ' ] = 'english ' ;
@@ -241,7 +246,7 @@ public function search_with_soft_deletes()
241
246
->shouldReceive ('whereNull ' )->with ('deleted_at ' )
242
247
->shouldReceive ('getBindings ' )->andReturn ([null , 'foo ' , 1 ]);
243
248
244
- $ db ->shouldReceive ('select ' )->with (null , $ table ->getBindings ());
249
+ $ db ->shouldReceive ('select ' )->with (null , $ table ->getBindings ())-> once () ;
245
250
246
251
$ builder = new Builder (new SoftDeletableTestModel , 'foo ' );
247
252
$ builder ->where ('bar ' , 1 )->take (5 );
0 commit comments