| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace GeneaLabs\LaravelModelCaching\Tests\Integration\CachedBuilder; |
||
| 9 | public function testBooleanWhereCreatesCorrectCacheKey() |
||
| 10 | { |
||
| 11 | $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-is_famous_=_1-authors.deleted_at_null"); |
||
| 12 | $tags = [ |
||
| 13 | "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", |
||
| 14 | ]; |
||
| 15 | |||
| 16 | $authors = (new Author) |
||
| 17 | ->where("is_famous", true) |
||
| 18 | ->get(); |
||
| 19 | $cachedResults = $this->cache() |
||
| 20 | ->tags($tags) |
||
| 21 | ->get($key)['value']; |
||
| 22 | $liveResults = (new UncachedAuthor) |
||
| 23 | ->where("is_famous", true) |
||
| 24 | ->get(); |
||
| 25 | |||
| 26 | $this->assertEquals($liveResults->pluck("id"), $authors->pluck("id")); |
||
| 27 | $this->assertEquals($liveResults->pluck("id"), $cachedResults->pluck("id")); |
||
| 28 | $this->assertNotEmpty($authors); |
||
| 29 | $this->assertNotEmpty($cachedResults); |
||
| 30 | $this->assertNotEmpty($liveResults); |
||
| 31 | } |
||
| 32 | } |
||
| 33 |