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()
865865 ->get ();
866866 $ key2 = sha1 ('genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor ' );
867867
868- cache ()->tags ($ tags1 )
868+ cache ()
869+ ->tags ($ tags1 )
869870 ->rememberForever (
870871 $ key1 ,
871872 function () use ($ key2 , $ authors ) {
@@ -886,4 +887,22 @@ function () use ($key2, $authors) {
886887 $ this ->assertTrue ($ cachedResults ->diffKeys ($ books )->isEmpty ());
887888 $ this ->assertTrue ($ cachedResults ->diffKeys ($ authors )->isNotEmpty ());
888889 }
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+ }
889908}
You can’t perform that action at this time.
0 commit comments