File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -618,4 +618,25 @@ public function testScopeClauseParsing()
618618 $ this ->assertTrue ($ cachedResults ->contains ($ author ));
619619 $ this ->assertTrue ($ liveResults ->contains ($ author ));
620620 }
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+ }
621642}
You can’t perform that action at this time.
0 commit comments