@@ -504,34 +504,58 @@ public function testNestedRelationshipWhereClauseParsing()
504504
505505 public function testExistsRelationshipWhereClauseParsing ()
506506 {
507+ $ authors = (new Author )->whereHas ('books ' )
508+ ->get ();
507509
508- $ authors = collect ([(new Author )->whereHas ('books ' )->first ()]);
509-
510- $ key = 'genealabslaravelmodelcachingtestsfixturesauthor_and_authors.id_=_books.author_id-first ' ;
510+ $ key = 'genealabslaravelmodelcachingtestsfixturesauthor_exists_and_authors.id_=_books.author_id ' ;
511511 $ tags = ['genealabslaravelmodelcachingtestsfixturesauthor ' ];
512512
513- $ cachedResults = collect ([cache ()->tags ($ tags )->get ($ key )]);
513+ $ cachedResults = cache ()->tags ($ tags )->get ($ key );
514+ $ liveResults = (new UncachedAuthor )->whereHas ('books ' )
515+ ->get ();
514516
515- $ liveResults = collect ([(new UncachedAuthor )
516- ->whereHas ('books ' )->first ()]);
517+ $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
518+ $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
519+ }
517520
518- $ this ->assertTrue ($ authors ->diffAssoc ($ cachedResults )->isEmpty ());
519- $ this ->assertTrue ($ liveResults ->diffAssoc ($ cachedResults )->isEmpty ());
521+ public function testDoesntHaveWhereClaseParsing ()
522+ {
523+ $ authors = (new Author )
524+ ->doesntHave ('books ' )
525+ ->get ();
526+
527+ $ key = 'genealabslaravelmodelcachingtestsfixturesauthor_notexists_and_authors.id_=_books.author_id ' ;
528+ $ tags = ['genealabslaravelmodelcachingtestsfixturesauthor ' ];
529+
530+ $ cachedResults = cache ()
531+ ->tags ($ tags )
532+ ->get ($ key );
533+ $ liveResults = (new UncachedAuthor )
534+ ->doesntHave ('books ' )
535+ ->get ();
520536
537+ $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
538+ $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
521539 }
522540
523541 public function testColumnsRelationshipWhereClauseParsing ()
524542 {
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 ' ;
543+ $ author = (new Author )
544+ ->orderBy ('name ' )
545+ ->first ();
546+ $ authors = (new Author )
547+ ->where ('name ' , '= ' , $ author ->name )
548+ ->get ();
549+ $ key = 'genealabslaravelmodelcachingtestsfixturesauthor-name_ ' .
550+ $ author ->name ;
530551 $ tags = ['genealabslaravelmodelcachingtestsfixturesauthor ' ];
531552
532- $ cachedResults = collect ([cache ()->tags ($ tags )->get ($ key )]);
533-
534- $ liveResults = collect ([(new UncachedAuthor )->where ('name ' , '= ' , $ author ->name )->first ()]);
553+ $ cachedResults = cache ()
554+ ->tags ($ tags )
555+ ->get ($ key );
556+ $ liveResults = (new UncachedAuthor )
557+ ->where ('name ' , '= ' , $ author ->name )
558+ ->get ();
535559
536560 $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
537561 $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
0 commit comments