Skip to content

Commit 1b6933c

Browse files
committed
Merge branch 'master' into develop
2 parents b54409c + e4dc124 commit 1b6933c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

tests/Unit/CachedBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testCacheIsEmptyBeforeLoadingModels()
5959

6060
$this->assertNull($results);
6161
}
62-
/** @group test */
62+
6363
public function testCacheIsNotEmptyAfterLoadingModels()
6464
{
6565
(new Author)->with('books')->get();

tests/Unit/Traits/CachableTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedStore;
1414
use GeneaLabs\LaravelModelCaching\Tests\UnitTestCase;
1515
use Illuminate\Foundation\Testing\RefreshDatabase;
16+
use Illuminate\Database\Eloquent\Collection;
1617

1718
class CachableTest extends UnitTestCase
1819
{
@@ -83,4 +84,22 @@ public function testSetCachePrefixAttribute()
8384

8485
$this->assertNotNull($results);
8586
}
87+
88+
public function testAllReturnsCollection()
89+
{
90+
(new Author)->truncate();
91+
factory(Author::class, 1)->create();
92+
$authors = (new Author)->all();
93+
94+
$cachedResults = cache()
95+
->tags([
96+
'genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor',
97+
])
98+
->get(sha1('genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor'))['value'];
99+
$liveResults = (new UncachedAuthor)->all();
100+
101+
$this->assertInstanceOf(Collection::class, $authors);
102+
$this->assertInstanceOf(Collection::class, $cachedResults);
103+
$this->assertInstanceOf(Collection::class, $liveResults);
104+
}
86105
}

0 commit comments

Comments
 (0)