|
@@ 22-44 (lines=23) @@
|
| 19 |
|
} |
| 20 |
|
} |
| 21 |
|
|
| 22 |
|
public function testGivenModelIsFlushed() |
| 23 |
|
{ |
| 24 |
|
$authors = (new Author)->all(); |
| 25 |
|
$key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null"); |
| 26 |
|
$tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; |
| 27 |
|
|
| 28 |
|
$cachedResults = $this |
| 29 |
|
->cache |
| 30 |
|
->tags($tags) |
| 31 |
|
->get($key)['value']; |
| 32 |
|
$result = $this |
| 33 |
|
->artisan('modelCache:clear', ['--model' => Author::class]) |
| 34 |
|
->execute(); |
| 35 |
|
$flushedResults = $this |
| 36 |
|
->cache |
| 37 |
|
->tags($tags) |
| 38 |
|
->get($key)['value'] |
| 39 |
|
?? null; |
| 40 |
|
|
| 41 |
|
$this->assertEquals($authors, $cachedResults); |
| 42 |
|
$this->assertEmpty($flushedResults); |
| 43 |
|
$this->assertEquals($result, 0); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
public function testExtendedModelIsFlushed() |
| 47 |
|
{ |
|
@@ 46-70 (lines=25) @@
|
| 43 |
|
$this->assertEquals($result, 0); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
public function testExtendedModelIsFlushed() |
| 47 |
|
{ |
| 48 |
|
$authors = (new PrefixedAuthor) |
| 49 |
|
->get(); |
| 50 |
|
|
| 51 |
|
$key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:authors:genealabslaravelmodelcachingtestsfixturesprefixedauthor-authors.deleted_at_null"); |
| 52 |
|
$tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:genealabslaravelmodelcachingtestsfixturesprefixedauthor"]; |
| 53 |
|
|
| 54 |
|
$cachedResults = $this |
| 55 |
|
->cache |
| 56 |
|
->tags($tags) |
| 57 |
|
->get($key)['value']; |
| 58 |
|
$result = $this |
| 59 |
|
->artisan('modelCache:clear', ['--model' => PrefixedAuthor::class]) |
| 60 |
|
->execute(); |
| 61 |
|
$flushedResults = $this |
| 62 |
|
->cache |
| 63 |
|
->tags($tags) |
| 64 |
|
->get($key)['value'] |
| 65 |
|
?? null; |
| 66 |
|
|
| 67 |
|
$this->assertEquals($authors, $cachedResults); |
| 68 |
|
$this->assertEmpty($flushedResults); |
| 69 |
|
$this->assertEquals($result, 0); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
public function testGivenModelWithRelationshipIsFlushed() |
| 73 |
|
{ |