@@ 114-129 (lines=16) @@ | ||
111 | $this->assertNull($results); |
|
112 | } |
|
113 | ||
114 | public function testHasManyRelationshipIsCached() |
|
115 | { |
|
116 | $authors = (new Author)->with('books')->get(); |
|
117 | ||
118 | $results = collect(cache()->tags([ |
|
119 | 'genealabslaravelmodelcachingtestsfixturesauthor', |
|
120 | 'genealabslaravelmodelcachingtestsfixturesbook' |
|
121 | ]) |
|
122 | ->get("genealabslaravelmodelcachingtestsfixturesauthor-books")); |
|
123 | ||
124 | $this->assertNotNull($results); |
|
125 | $this->assertEmpty($authors->diffAssoc($results)); |
|
126 | $this->assertNotEmpty($authors); |
|
127 | $this->assertNotEmpty($results); |
|
128 | $this->assertEquals($authors->count(), $results->count()); |
|
129 | } |
|
130 | ||
131 | public function testBelongsToRelationshipIsCached() |
|
132 | { |
|
@@ 131-146 (lines=16) @@ | ||
128 | $this->assertEquals($authors->count(), $results->count()); |
|
129 | } |
|
130 | ||
131 | public function testBelongsToRelationshipIsCached() |
|
132 | { |
|
133 | $books = (new Book)->with('author')->get(); |
|
134 | ||
135 | $results = collect(cache()->tags([ |
|
136 | 'genealabslaravelmodelcachingtestsfixturesbook', |
|
137 | 'genealabslaravelmodelcachingtestsfixturesauthor' |
|
138 | ]) |
|
139 | ->get("genealabslaravelmodelcachingtestsfixturesbook-author")); |
|
140 | ||
141 | $this->assertNotNull($results); |
|
142 | $this->assertEmpty($books->diffAssoc($results)); |
|
143 | $this->assertNotEmpty($books); |
|
144 | $this->assertNotEmpty($results); |
|
145 | $this->assertEquals($books->count(), $results->count()); |
|
146 | } |
|
147 | ||
148 | public function testBelongsToManyRelationshipIsCached() |
|
149 | { |
|
@@ 148-163 (lines=16) @@ | ||
145 | $this->assertEquals($books->count(), $results->count()); |
|
146 | } |
|
147 | ||
148 | public function testBelongsToManyRelationshipIsCached() |
|
149 | { |
|
150 | $books = (new Book)->with('stores')->get(); |
|
151 | ||
152 | $results = collect(cache()->tags([ |
|
153 | 'genealabslaravelmodelcachingtestsfixturesbook', |
|
154 | 'genealabslaravelmodelcachingtestsfixturesstore' |
|
155 | ]) |
|
156 | ->get("genealabslaravelmodelcachingtestsfixturesbook-stores")); |
|
157 | ||
158 | $this->assertNotNull($results); |
|
159 | $this->assertEmpty($books->diffAssoc($results)); |
|
160 | $this->assertNotEmpty($books); |
|
161 | $this->assertNotEmpty($results); |
|
162 | $this->assertEquals($books->count(), $results->count()); |
|
163 | } |
|
164 | ||
165 | public function testHasOneRelationshipIsCached() |
|
166 | { |
|
@@ 165-181 (lines=17) @@ | ||
162 | $this->assertEquals($books->count(), $results->count()); |
|
163 | } |
|
164 | ||
165 | public function testHasOneRelationshipIsCached() |
|
166 | { |
|
167 | $authors = (new Author)->with('profile')->get(); |
|
168 | ||
169 | $results = collect(cache() |
|
170 | ->tags([ |
|
171 | 'genealabslaravelmodelcachingtestsfixturesauthor', |
|
172 | 'genealabslaravelmodelcachingtestsfixturesprofile' |
|
173 | ]) |
|
174 | ->get("genealabslaravelmodelcachingtestsfixturesauthor-profile")); |
|
175 | ||
176 | $this->assertNotNull($results); |
|
177 | $this->assertEmpty($authors->diffAssoc($results)); |
|
178 | $this->assertNotEmpty($authors); |
|
179 | $this->assertNotEmpty($results); |
|
180 | $this->assertEquals($authors->count(), $results->count()); |
|
181 | } |
|
182 | ||
183 | public function testAvgModelResultsCreatesCache() |
|
184 | { |