for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace GeneaLabs\LaravelModelCaching\Tests\Integration\CachedBuilder;
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Author;
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedAuthor;
use GeneaLabs\LaravelModelCaching\Tests\IntegrationTestCase;
class BooleanTest extends IntegrationTestCase
{
public function testBooleanWhereCreatesCorrectCacheKey()
$key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-is_famous_=_1-authors.deleted_at_null");
$tags = [
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor",
];
$authors = (new Author)
->where("is_famous", true)
->get();
$cachedResults = $this->cache()
->tags($tags)
->get($key)['value'];
$liveResults = (new UncachedAuthor)
$this->assertEquals($liveResults->pluck("id"), $authors->pluck("id"));
$this->assertEquals($liveResults->pluck("id"), $cachedResults->pluck("id"));
$this->assertNotEmpty($authors);
$this->assertNotEmpty($cachedResults);
$this->assertNotEmpty($liveResults);
}