|
@@ 242-258 (lines=17) @@
|
| 239 |
|
} |
| 240 |
|
} |
| 241 |
|
|
| 242 |
|
public function testCountModelResultsCreatesCache() |
| 243 |
|
{ |
| 244 |
|
$authors = (new Author)->with('books', 'profile') |
| 245 |
|
->count(); |
| 246 |
|
$key = 'genealabslaravelmodelcachingtestsfixturesauthor-count'; |
| 247 |
|
$tags = [ |
| 248 |
|
'genealabslaravelmodelcachingtestsfixturesauthor', |
| 249 |
|
]; |
| 250 |
|
|
| 251 |
|
$cachedResults = cache()->tags($tags) |
| 252 |
|
->get($key); |
| 253 |
|
$liveResults = (new UncachedAuthor)->with('books', 'profile') |
| 254 |
|
->count(); |
| 255 |
|
|
| 256 |
|
$this->assertEquals($authors, $cachedResults); |
| 257 |
|
$this->assertEquals($liveResults, $cachedResults); |
| 258 |
|
} |
| 259 |
|
|
| 260 |
|
public function testFindModelResultsCreatesCache() |
| 261 |
|
{ |
|
@@ 276-294 (lines=19) @@
|
| 273 |
|
$this->assertEmpty($liveResults->diffAssoc($cachedResults)); |
| 274 |
|
} |
| 275 |
|
|
| 276 |
|
public function testGetModelResultsCreatesCache() |
| 277 |
|
{ |
| 278 |
|
$authors = (new Author)->with('books', 'profile') |
| 279 |
|
->get(); |
| 280 |
|
$key = 'genealabslaravelmodelcachingtestsfixturesauthor-books-profile'; |
| 281 |
|
$tags = [ |
| 282 |
|
'genealabslaravelmodelcachingtestsfixturesauthor', |
| 283 |
|
'genealabslaravelmodelcachingtestsfixturesbook', |
| 284 |
|
'genealabslaravelmodelcachingtestsfixturesprofile', |
| 285 |
|
]; |
| 286 |
|
|
| 287 |
|
$cachedResults = cache()->tags($tags) |
| 288 |
|
->get($key); |
| 289 |
|
$liveResults = (new UncachedAuthor)->with('books', 'profile') |
| 290 |
|
->get(); |
| 291 |
|
|
| 292 |
|
$this->assertEquals($authors, $cachedResults); |
| 293 |
|
$this->assertEmpty($liveResults->diffAssoc($cachedResults)); |
| 294 |
|
} |
| 295 |
|
|
| 296 |
|
// test cursor() |
| 297 |
|
|