@@ 50-61 (lines=12) @@ | ||
47 | $this->assertNull($results); |
|
48 | } |
|
49 | ||
50 | public function testCacheIsNotEmptyAfterLoadingModels() |
|
51 | { |
|
52 | (new Author)->with('books')->get(); |
|
53 | ||
54 | $results = cache()->tags([ |
|
55 | 'genealabslaravelmodelcachingtestsfixturesauthor', |
|
56 | 'genealabslaravelmodelcachingtestsfixturesbook' |
|
57 | ]) |
|
58 | ->get('genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks'); |
|
59 | ||
60 | $this->assertNotNull($results); |
|
61 | } |
|
62 | ||
63 | public function testCreatingModelClearsCache() |
|
64 | { |
|
@@ 63-76 (lines=14) @@ | ||
60 | $this->assertNotNull($results); |
|
61 | } |
|
62 | ||
63 | public function testCreatingModelClearsCache() |
|
64 | { |
|
65 | $author = (new Author)->with('books')->get(); |
|
66 | ||
67 | factory(Author::class)->create(); |
|
68 | ||
69 | $results = cache()->tags([ |
|
70 | 'genealabslaravelmodelcachingtestsfixturesauthor', |
|
71 | 'genealabslaravelmodelcachingtestsfixturesbook' |
|
72 | ]) |
|
73 | ->get('genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks'); |
|
74 | ||
75 | $this->assertNull($results); |
|
76 | } |
|
77 | ||
78 | public function testUpdatingModelClearsCache() |
|
79 | { |
|
@@ 78-91 (lines=14) @@ | ||
75 | $this->assertNull($results); |
|
76 | } |
|
77 | ||
78 | public function testUpdatingModelClearsCache() |
|
79 | { |
|
80 | $author = (new Author)->with('books')->get()->first(); |
|
81 | $author->name = "John Jinglheimer"; |
|
82 | $author->save(); |
|
83 | ||
84 | $results = cache()->tags([ |
|
85 | 'genealabslaravelmodelcachingtestsfixturesauthor', |
|
86 | 'genealabslaravelmodelcachingtestsfixturesbook' |
|
87 | ]) |
|
88 | ->get('genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks'); |
|
89 | ||
90 | $this->assertNull($results); |
|
91 | } |
|
92 | ||
93 | public function testDeletingModelClearsCache() |
|
94 | { |
|
@@ 93-105 (lines=13) @@ | ||
90 | $this->assertNull($results); |
|
91 | } |
|
92 | ||
93 | public function testDeletingModelClearsCache() |
|
94 | { |
|
95 | $author = (new Author)->with('books')->get()->first(); |
|
96 | $author->delete(); |
|
97 | ||
98 | $results = cache()->tags([ |
|
99 | 'genealabslaravelmodelcachingtestsfixturesauthor', |
|
100 | 'genealabslaravelmodelcachingtestsfixturesbook' |
|
101 | ]) |
|
102 | ->get('genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks'); |
|
103 | ||
104 | $this->assertNull($results); |
|
105 | } |
|
106 | ||
107 | public function testHasManyRelationshipIsCached() |
|
108 | { |