File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ public function testCacheIsEmptyBeforeLoadingModels()
59
59
60
60
$ this ->assertNull ($ results );
61
61
}
62
- /** @group test */
62
+
63
63
public function testCacheIsNotEmptyAfterLoadingModels ()
64
64
{
65
65
(new Author )->with ('books ' )->get ();
Original file line number Diff line number Diff line change 13
13
use GeneaLabs \LaravelModelCaching \Tests \Fixtures \UncachedStore ;
14
14
use GeneaLabs \LaravelModelCaching \Tests \UnitTestCase ;
15
15
use Illuminate \Foundation \Testing \RefreshDatabase ;
16
+ use Illuminate \Database \Eloquent \Collection ;
16
17
17
18
class CachableTest extends UnitTestCase
18
19
{
@@ -83,4 +84,22 @@ public function testSetCachePrefixAttribute()
83
84
84
85
$ this ->assertNotNull ($ results );
85
86
}
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
+ }
86
105
}
You can’t perform that action at this time.
0 commit comments