File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -865,7 +865,8 @@ public function testHashCollision()
865
865
->get ();
866
866
$ key2 = sha1 ('genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor ' );
867
867
868
- cache ()->tags ($ tags1 )
868
+ cache ()
869
+ ->tags ($ tags1 )
869
870
->rememberForever (
870
871
$ key1 ,
871
872
function () use ($ key2 , $ authors ) {
@@ -886,4 +887,22 @@ function () use ($key2, $authors) {
886
887
$ this ->assertTrue ($ cachedResults ->diffKeys ($ books )->isEmpty ());
887
888
$ this ->assertTrue ($ cachedResults ->diffKeys ($ authors )->isNotEmpty ());
888
889
}
890
+
891
+ public function testSubsequentDisabledCacheQueriesDoNotCache ()
892
+ {
893
+ (new Author )->disableCache ()->get ();
894
+ $ key = sha1 ('genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor ' );
895
+ $ tags = ['genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor ' ];
896
+ $ cachedAuthors1 = cache ()
897
+ ->tags ($ tags )
898
+ ->get ($ key )['value ' ];
899
+
900
+ (new Author )->disableCache ()->get ();
901
+ $ cachedAuthors2 = cache ()
902
+ ->tags ($ tags )
903
+ ->get ($ key )['value ' ];
904
+
905
+ $ this ->assertEmpty ($ cachedAuthors1 );
906
+ $ this ->assertEmpty ($ cachedAuthors2 );
907
+ }
889
908
}
You can’t perform that action at this time.
0 commit comments