File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -618,4 +618,25 @@ public function testScopeClauseParsing()
618
618
$ this ->assertTrue ($ cachedResults ->contains ($ author ));
619
619
$ this ->assertTrue ($ liveResults ->contains ($ author ));
620
620
}
621
+
622
+ public function testRelationshipQueriesAreCached ()
623
+ {
624
+ $ books = (new Author )
625
+ ->first ()
626
+ ->books ()
627
+ ->get ();
628
+ $ key = 'genealabslaravelmodelcachingtestsfixturesbook-books.author_id_1-books.author_id_notnull ' ;
629
+ $ tags = [
630
+ 'genealabslaravelmodelcachingtestsfixturesbook '
631
+ ];
632
+
633
+ $ cachedResults = cache ()->tags ($ tags )->get ($ key );
634
+ $ liveResults = (new UncachedAuthor )
635
+ ->first ()
636
+ ->books ()
637
+ ->get ();
638
+
639
+ $ this ->assertTrue ($ cachedResults ->diffAssoc ($ books )->isEmpty ());
640
+ $ this ->assertTrue ($ liveResults ->diffAssoc ($ books )->isEmpty ());
641
+ }
621
642
}
You can’t perform that action at this time.
0 commit comments