File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
tests/Integration/CachedBuilder Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -102,4 +102,25 @@ public function testNestedWhereRawWithBindings()
102102
103103 $ this ->assertEquals ($ books ->pluck ("id " ), $ uncachedBooks ->pluck ("id " ));
104104 }
105+
106+ public function testWhereRawParametersCacheUniquely ()
107+ {
108+ $ book1 = (new UncachedBook )->first ();
109+ $ book2 = (new UncachedBook )->orderBy ("id " , "DESC " )->first ();
110+
111+ $ result1 = (new Book )
112+ ->whereRaw ("id = ? " , [$ book1 ->id ])
113+ ->get ();
114+ $ result2 = (new Book )
115+ ->whereRaw ("id = ? " , [$ book2 ->id ])
116+ ->get ();
117+ $ key1 = sha1 ("genealabs:laravel-model-caching:testing::memory::books:genealabslaravelmodelcachingtestsfixturesbook-_and_id_=_ {$ book1 ->id }" );
118+ $ key2 = sha1 ("genealabs:laravel-model-caching:testing::memory::books:genealabslaravelmodelcachingtestsfixturesbook-_and_id_=_ {$ book2 ->id }" );
119+ $ tags = ['genealabs:laravel-model-caching:testing::memory::genealabslaravelmodelcachingtestsfixturesbook ' ];
120+ $ cachedBook1 = $ this ->cache ()->tags ($ tags )->get ($ key1 )['value ' ];
121+ $ cachedBook2 = $ this ->cache ()->tags ($ tags )->get ($ key2 )['value ' ];
122+
123+ $ this ->assertEquals ($ cachedBook1 ->first ()->title , $ result1 ->first ()->title );
124+ $ this ->assertEquals ($ cachedBook2 ->first ()->title , $ result2 ->first ()->title );
125+ }
105126}
You can’t perform that action at this time.
0 commit comments