@@ -182,106 +182,28 @@ public function testInvalidatingCacheWhenSyncing()
182182 $ tags = [
183183 "genealabs:laravel-model-caching:testing: {$ this ->testingSqlitePath }testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore " ,
184184 ];
185-
186185 $ newStores = factory (Store::class, 2 )
187186 ->create ();
188-
189187 $ result = Book::find ($ bookId )
190188 ->stores ;
191189
192190 Book::find ($ bookId )
193191 ->stores ()
194192 ->attach ($ newStores [0 ]->id );
195-
196193 Book::find ($ bookId )
197194 ->stores ()
198195 ->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-
205196 $ cachedResult = $ this
206197 ->cache ()
207198 ->tags ($ tags )
208199 ->get ($ key )['value ' ]
209200 ?? null ;
210201
202+ $ this ->assertEmpty (array_diff (
203+ Book::find ($ bookId )->stores ()->pluck ((new Store )->getTable () . '.id ' )->toArray (),
204+ $ newStores ->pluck ('id ' )->toArray ()
205+ ));
211206 $ this ->assertNotEmpty ($ result );
212207 $ this ->assertNull ($ cachedResult );
213208 }
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- // }
287209}
0 commit comments