@@ -413,7 +413,7 @@ public function testValueModelResultsCreatesCache()
413413 $ this ->assertEquals ($ liveResults , $ cachedResults );
414414 }
415415
416- public function testNestedRelationshipEagerloading ()
416+ public function testNestedRelationshipEagerLoading ()
417417 {
418418 $ authors = collect ([(new Author )->with ('books.publisher ' )
419419 ->first ()]);
@@ -504,14 +504,34 @@ public function testNestedRelationshipWhereClauseParsing()
504504
505505 public function testExistsRelationshipWhereClauseParsing ()
506506 {
507- $ authors = (new Author )->whereHas ('books ' )
508- ->get ();
509- $ key = 'genealabslaravelmodelcachingtestsfixturesauthor_and_authors.id_=_books.author_id ' ;
507+
508+ $ authors = collect ([(new Author )->whereHas ('books ' )->first ()]);
509+
510+ $ key = 'genealabslaravelmodelcachingtestsfixturesauthor_and_authors.id_=_books.author_id-first ' ;
510511 $ tags = ['genealabslaravelmodelcachingtestsfixturesauthor ' ];
511512
512- $ cachedResults = cache ()->tags ($ tags )->get ($ key );
513- $ liveResults = (new UncachedAuthor )->whereHas ('books ' )
514- ->get ();
513+ $ cachedResults = collect ([cache ()->tags ($ tags )->get ($ key )]);
514+
515+ $ liveResults = collect ([(new UncachedAuthor )
516+ ->whereHas ('books ' )->first ()]);
517+
518+ $ this ->assertTrue ($ authors ->diffAssoc ($ cachedResults )->isEmpty ());
519+ $ this ->assertTrue ($ liveResults ->diffAssoc ($ cachedResults )->isEmpty ());
520+
521+ }
522+
523+ public function testColumnsRelationshipWhereClauseParsing ()
524+ {
525+ $ author = (new Author )->orderBy ('name ' )->first ();
526+
527+ $ authors = collect ([(new Author )->where ('name ' , '= ' , $ author ->name )->first ()]);
528+
529+ $ key = 'genealabslaravelmodelcachingtestsfixturesauthor-name_ ' . $ author ->name . '-first ' ;
530+ $ tags = ['genealabslaravelmodelcachingtestsfixturesauthor ' ];
531+
532+ $ cachedResults = collect ([cache ()->tags ($ tags )->get ($ key )]);
533+
534+ $ liveResults = collect ([(new UncachedAuthor )->where ('name ' , '= ' , $ author ->name )->first ()]);
515535
516536 $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
517537 $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
0 commit comments