File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ 0.2.35] - 21 Feb 2018
8+ ### Fixed
9+ - cache key generation for ` find() ` and ` findOrFail() ` .
10+
711## [ 0.2.33] - 19 Feb 2018
812### Added
913- unit test to make sure ` Model::all() ` returns a collection when only only
Original file line number Diff line number Diff line change @@ -863,4 +863,24 @@ public function testSubsequentFindsReturnDifferentModels()
863863 $ this ->assertEquals ($ author1 ->id , 1 );
864864 $ this ->assertEquals ($ author2 ->id , 2 );
865865 }
866+
867+ public function testFindOrFailCachesModels ()
868+ {
869+ $ author = (new Author )
870+ ->findOrFail (1 );
871+
872+ $ key = sha1 ('genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor-find_1 ' );
873+ $ tags = [
874+ 'genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor ' ,
875+ ];
876+
877+ $ cachedResults = $ this ->cache ()
878+ ->tags ($ tags )
879+ ->get ($ key )['value ' ];
880+ $ liveResults = (new UncachedAuthor )
881+ ->findOrFail (1 );
882+
883+ $ this ->assertEquals ($ cachedResults ->toArray (), $ author ->toArray ());
884+ $ this ->assertEquals ($ liveResults ->toArray (), $ author ->toArray ());
885+ }
866886}
You can’t perform that action at this time.
0 commit comments