@@ -182,106 +182,28 @@ public function testInvalidatingCacheWhenSyncing()
182
182
$ tags = [
183
183
"genealabs:laravel-model-caching:testing: {$ this ->testingSqlitePath }testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore " ,
184
184
];
185
-
186
185
$ newStores = factory (Store::class, 2 )
187
186
->create ();
188
-
189
187
$ result = Book::find ($ bookId )
190
188
->stores ;
191
189
192
190
Book::find ($ bookId )
193
191
->stores ()
194
192
->attach ($ newStores [0 ]->id );
195
-
196
193
Book::find ($ bookId )
197
194
->stores ()
198
195
->sync ($ newStores ->pluck ('id ' ));
199
-
200
- $ this ->assertEmpty (array_diff (
201
- Book::find ($ bookId )->stores ()->pluck ((new Store )->getTable () . '.id ' )->toArray (),
202
- $ newStores ->pluck ('id ' )->toArray ()
203
- ));
204
-
205
196
$ cachedResult = $ this
206
197
->cache ()
207
198
->tags ($ tags )
208
199
->get ($ key )['value ' ]
209
200
?? null ;
210
201
202
+ $ this ->assertEmpty (array_diff (
203
+ Book::find ($ bookId )->stores ()->pluck ((new Store )->getTable () . '.id ' )->toArray (),
204
+ $ newStores ->pluck ('id ' )->toArray ()
205
+ ));
211
206
$ this ->assertNotEmpty ($ result );
212
207
$ this ->assertNull ($ cachedResult );
213
208
}
214
-
215
- // /** @group test */
216
- // public function testUncachedDetachesFromCached()
217
- // {
218
- // // $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}");
219
- // // $tags = [
220
- // // "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore",
221
- // // ];
222
-
223
- // $store = (new StoreWithUncachedBooks)
224
- // ->with("books")
225
- // ->has("books")
226
- // ->first();
227
- // $store->books()
228
- // ->detach();
229
- // // $store->delete();
230
- // // dd($results);
231
- // // $cachedResult = $this
232
- // // ->cache()
233
- // // ->tags($tags)
234
- // // ->get($key)['value'];
235
-
236
- // // $this->assertNotEmpty($result);
237
- // // $this->assertNull($cachedResult);
238
- // }
239
-
240
- // /** @group test */
241
- // public function testCachedDetachesFromUncached()
242
- // {
243
- // // $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}");
244
- // // $tags = [
245
- // // "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore",
246
- // // ];
247
- // $book = (new UncachedBookWithStores)
248
- // ->with("stores")
249
- // ->has("stores")
250
- // ->first();
251
- // $book->stores()
252
- // ->detach();
253
- // // $book->delete();
254
- // // dd($results);
255
- // // $cachedResult = $this
256
- // // ->cache()
257
- // // ->tags($tags)
258
- // // ->get($key)['value'];
259
-
260
- // // $this->assertNotEmpty($result);
261
- // // $this->assertNull($cachedResult);
262
- // }
263
-
264
- // public function testDetachingFiresEvent()
265
- // {
266
- // // $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}");
267
- // // $tags = [
268
- // // "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore",
269
- // // ];
270
-
271
- // $store = (new Store)
272
- // ->with("books")
273
- // ->has("books")
274
- // ->first();
275
- // $store->books()
276
- // ->detach();
277
- // $store->delete();
278
- // // dd($results);
279
- // // $cachedResult = $this
280
- // // ->cache()
281
- // // ->tags($tags)
282
- // // ->get($key)['value'];
283
-
284
- // // $this->assertNotEmpty($result);
285
- // // $this->assertNull($cachedResult);
286
- // }
287
209
}
0 commit comments