Code Duplication    Length = 24-24 lines in 2 locations

tests/Integration/CachedBuilder/SoftDeletesTest.php 2 locations

@@ 9-32 (lines=24) @@
6
7
class SoftDeletesTest extends IntegrationTestCase
8
{
9
    public function testWithTrashedIsCached()
10
    {
11
        $author = (new UncachedAuthor)
12
            ->first();
13
        $author->delete();
14
        $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-find_1-withTrashed");
15
        $tags = [
16
            "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor",
17
        ];
18
19
        $deletedAuthor = (new Author)
20
            ->withTrashed()
21
            ->find($author->id);
22
        $cachedResults = $this
23
            ->cache()
24
            ->tags($tags)
25
            ->get($key)['value'];
26
        $deletedUncachedAuthor = (new UncachedAuthor)
27
            ->withTrashed()
28
            ->find($author->id);
29
30
        $this->assertEquals($cachedResults->toArray(), $deletedAuthor->toArray());
31
        $this->assertEquals($cachedResults->toArray(), $deletedUncachedAuthor->toArray());
32
    }
33
34
    public function testWithoutTrashedIsCached()
35
    {
@@ 62-85 (lines=24) @@
59
        $this->assertNull($uncachedResult);
60
    }
61
62
    public function testonlyTrashedIsCached()
63
    {
64
        $author = (new UncachedAuthor)
65
            ->first();
66
        $author->delete();
67
        $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_notnull-find_{$author->id}-onlyTrashed");
68
        $tags = [
69
            "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor",
70
        ];
71
72
        $deletedAuthor = (new Author)
73
            ->onlyTrashed()
74
            ->find($author->id);
75
        $cachedResults = $this
76
            ->cache()
77
            ->tags($tags)
78
            ->get($key)['value'];
79
        $deletedUncachedAuthor = (new UncachedAuthor)
80
            ->onlyTrashed()
81
            ->find($author->id);
82
83
        $this->assertEquals($cachedResults->toArray(), $deletedAuthor->toArray());
84
        $this->assertEquals($cachedResults->toArray(), $deletedUncachedAuthor->toArray());
85
    }
86
}
87