File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -44,4 +44,27 @@ public function testWhereHasRelationship()
4444
4545 $ this ->assertEquals ($ books ->pluck ("id " ), $ uncachedBooks ->pluck ("id " ));
4646 }
47+
48+ public function testNonCacheableEagerLoadedRelationsAreCleared ()
49+ {
50+ $ book = Book::with ("uncachedStores " )
51+ ->whereHas ("uncachedStores " )
52+ ->get ()
53+ ->first ();
54+
55+ $ store = $ book ->uncachedStores ->first ();
56+ $ store ->name = "Waterstones " ;
57+ $ store ->save ();
58+
59+ $ results = $ this ->cache ()->tags ([
60+ "genealabs:laravel-model-caching:testing: {$ this ->testingSqlitePath }testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook " ,
61+ "genealabs:laravel-model-caching:testing: {$ this ->testingSqlitePath }testing.sqlite:genealabslaravelmodelcachingtestsfixturesuncachedstore "
62+ ])
63+ ->get (sha1 (
64+ "genealabs:laravel-model-caching:testing: {$ this ->testingSqlitePath }testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-exists- " .
65+ "and_books.id_=_book_store.book_id-testing: {$ this ->testingSqlitePath }testing.sqlite:uncachedStores "
66+ ));
67+
68+ $ this ->assertNull ($ results );
69+ }
4770}
You can’t perform that action at this time.
0 commit comments