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()
5959
6060 $ this ->assertNull ($ results );
6161 }
62- /** @group test */
62+
6363 public function testCacheIsNotEmptyAfterLoadingModels ()
6464 {
6565 (new Author )->with ('books ' )->get ();
Original file line number Diff line number Diff line change 1313use GeneaLabs \LaravelModelCaching \Tests \Fixtures \UncachedStore ;
1414use GeneaLabs \LaravelModelCaching \Tests \UnitTestCase ;
1515use Illuminate \Foundation \Testing \RefreshDatabase ;
16+ use Illuminate \Database \Eloquent \Collection ;
1617
1718class 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}
You can’t perform that action at this time.
0 commit comments