@@ 29-39 (lines=11) @@ | ||
26 | $this->assertInstanceOf(Collection::class, $allAuthors); |
|
27 | } |
|
28 | ||
29 | public function testUsingDestroyInvalidatesCache() |
|
30 | { |
|
31 | $allAuthors = (new Author)->get(); |
|
32 | $firstAuthor = $allAuthors->first(); |
|
33 | (new Author)->destroy($firstAuthor->id); |
|
34 | $updatedAuthors = (new Author)->get()->keyBy("id"); |
|
35 | ||
36 | $this->assertNotEquals($allAuthors, $updatedAuthors); |
|
37 | $this->assertTrue($allAuthors->contains($firstAuthor)); |
|
38 | $this->assertFalse($updatedAuthors->contains($firstAuthor)); |
|
39 | } |
|
40 | ||
41 | public function testAllMethodCacheGetsInvalidated() |
|
42 | { |
|
@@ 41-51 (lines=11) @@ | ||
38 | $this->assertFalse($updatedAuthors->contains($firstAuthor)); |
|
39 | } |
|
40 | ||
41 | public function testAllMethodCacheGetsInvalidated() |
|
42 | { |
|
43 | $allAuthors = (new Author)->all(); |
|
44 | $firstAuthor = $allAuthors->first(); |
|
45 | $firstAuthor->delete(); |
|
46 | $updatedAuthors = (new Author)->all(); |
|
47 | ||
48 | $this->assertNotEquals($allAuthors, $updatedAuthors); |
|
49 | $this->assertTrue($allAuthors->contains($firstAuthor)); |
|
50 | $this->assertFalse($updatedAuthors->contains($firstAuthor)); |
|
51 | } |
|
52 | } |
|
53 |