Skip to content

Commit 9b8fdb1

Browse files
committed
Add another test case
1 parent 944b876 commit 9b8fdb1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/Integration/CachedModelTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@ public function testScopeDisablesCachingWhenCalledOnModel()
7171
$this->assertNotEquals($authors, $cachedResults);
7272
}
7373

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+
7492
public function testAllMethodCachingCanBeDisabledViaConfig()
7593
{
7694
config(['laravel-model-caching.disabled' => true]);

0 commit comments

Comments
 (0)