File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,24 @@ public function testScopeDisablesCachingWhenCalledOnModel()
71
71
$ this ->assertNotEquals ($ authors , $ cachedResults );
72
72
}
73
73
74
+ public function testScopeDisableCacheDoesntCrashWhenCachingIsDisabledInConfig ()
75
+ {
76
+ config (['laravel-model-caching.disabled ' => true ]);
77
+ $ key = sha1 ('genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor ' );
78
+ $ tags = ['genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor ' ];
79
+ $ authors = (new PrefixedAuthor )
80
+ ->where ("name " , "Bruno " )
81
+ ->disableCache ()
82
+ ->get ();
83
+
84
+ $ cachedResults = $ this ->cache ()
85
+ ->tags ($ tags )
86
+ ->get ($ key )['value ' ];
87
+
88
+ $ this ->assertNull ($ cachedResults );
89
+ $ this ->assertNotEquals ($ authors , $ cachedResults );
90
+ }
91
+
74
92
public function testAllMethodCachingCanBeDisabledViaConfig ()
75
93
{
76
94
config (['laravel-model-caching.disabled ' => true ]);
You can’t perform that action at this time.
0 commit comments