@@ -413,7 +413,7 @@ public function testValueModelResultsCreatesCache()
413
413
$ this ->assertEquals ($ liveResults , $ cachedResults );
414
414
}
415
415
416
- public function testNestedRelationshipEagerloading ()
416
+ public function testNestedRelationshipEagerLoading ()
417
417
{
418
418
$ authors = collect ([(new Author )->with ('books.publisher ' )
419
419
->first ()]);
@@ -504,14 +504,34 @@ public function testNestedRelationshipWhereClauseParsing()
504
504
505
505
public function testExistsRelationshipWhereClauseParsing ()
506
506
{
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 ' ;
510
511
$ tags = ['genealabslaravelmodelcachingtestsfixturesauthor ' ];
511
512
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 ()]);
515
535
516
536
$ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
517
537
$ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
0 commit comments