Code Duplication    Length = 16-17 lines in 2 locations

tests/Integration/CachedBuilderTest.php 1 location

@@ 400-415 (lines=16) @@
397
        $this->assertEmpty($liveResults->diffKeys($cachedResults));
398
    }
399
400
    public function testLazyLoadedRelationshipResolvesThroughCachedBuilder()
401
    {
402
        $books = (new Author)->first()->books;
403
        $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull");
404
        $tags = [
405
            "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook",
406
        ];
407
408
        $cachedResults = $this->cache()
409
            ->tags($tags)
410
            ->get($key)['value'];
411
        $liveResults = (new UncachedAuthor)->first()->books;
412
413
        $this->assertEmpty($books->diffKeys($cachedResults));
414
        $this->assertEmpty($liveResults->diffKeys($cachedResults));
415
    }
416
417
    public function testLazyLoadingOnResourceIsCached()
418
    {

tests/Integration/DisabledCachedModelTest.php 1 location

@@ 9-25 (lines=17) @@
6
7
class DisabledCachedModelTest extends IntegrationTestCase
8
{
9
    public function testCacheCanBeDisabledOnModel()
10
    {
11
        $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor");
12
        $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"];
13
        $authors = (new Author)
14
            ->disableCache()
15
            ->get();
16
17
        $cachedResults = $this->cache()
18
            ->tags($tags)
19
            ->get($key);
20
        $liveResults = (new UncachedAuthor)
21
            ->get();
22
23
        $this->assertEmpty($liveResults->diffAssoc($authors));
24
        $this->assertNull($cachedResults);
25
    }
26
27
    public function testCacheCanBeDisabledOnQuery()
28
    {