@@ -137,7 +137,7 @@ public function testHasManyRelationshipIsCached()
137137 ->get (sha1 ("genealabslaravelmodelcachingtestsfixturesauthor-books " )));
138138
139139 $ this ->assertNotNull ($ results );
140- $ this ->assertEmpty ($ authors ->diffAssoc ($ results ));
140+ $ this ->assertEmpty ($ authors ->diffKeys ($ results ));
141141 $ this ->assertNotEmpty ($ authors );
142142 $ this ->assertNotEmpty ($ results );
143143 $ this ->assertEquals ($ authors ->count (), $ results ->count ());
@@ -154,7 +154,7 @@ public function testBelongsToRelationshipIsCached()
154154 ->get (sha1 ("genealabslaravelmodelcachingtestsfixturesbook-author " )));
155155
156156 $ this ->assertNotNull ($ results );
157- $ this ->assertEmpty ($ books ->diffAssoc ($ results ));
157+ $ this ->assertEmpty ($ books ->diffKeys ($ results ));
158158 $ this ->assertNotEmpty ($ books );
159159 $ this ->assertNotEmpty ($ results );
160160 $ this ->assertEquals ($ books ->count (), $ results ->count ());
@@ -171,7 +171,7 @@ public function testBelongsToManyRelationshipIsCached()
171171 ->get (sha1 ("genealabslaravelmodelcachingtestsfixturesbook-stores " )));
172172
173173 $ this ->assertNotNull ($ results );
174- $ this ->assertEmpty ($ books ->diffAssoc ($ results ));
174+ $ this ->assertEmpty ($ books ->diffKeys ($ results ));
175175 $ this ->assertNotEmpty ($ books );
176176 $ this ->assertNotEmpty ($ results );
177177 $ this ->assertEquals ($ books ->count (), $ results ->count ());
@@ -189,7 +189,7 @@ public function testHasOneRelationshipIsCached()
189189 ->get (sha1 ("genealabslaravelmodelcachingtestsfixturesauthor-profile " )));
190190
191191 $ this ->assertNotNull ($ results );
192- $ this ->assertEmpty ($ authors ->diffAssoc ($ results ));
192+ $ this ->assertEmpty ($ authors ->diffKeys ($ results ));
193193 $ this ->assertNotEmpty ($ authors );
194194 $ this ->assertNotEmpty ($ results );
195195 $ this ->assertEquals ($ authors ->count (), $ results ->count ());
@@ -240,8 +240,7 @@ public function testChunkModelResultsCreatesCache()
240240
241241 $ cachedChunks ['authors ' ]->push ($ chunk );
242242 $ cachedChunks ['keys ' ]->push (sha1 (
243- "genealabslaravelmodelcachingtestsfixturesauthor-books-pr " .
244- "ofile_orderBy_authors.id_asc {$ offset }-limit_3 "
243+ "genealabslaravelmodelcachingtestsfixturesauthor-books-profile_orderBy_authors.id_asc {$ offset }-limit_3 "
245244 ));
246245 });
247246
@@ -255,8 +254,11 @@ public function testChunkModelResultsCreatesCache()
255254 $ cachedResults = cache ()->tags ($ tags )
256255 ->get ($ key );
257256
258- $ this ->assertEmpty ($ cachedChunks ['authors ' ][$ index ]->diffAssoc ($ cachedResults ));
259- $ this ->assertEmpty ($ uncachedChunks [$ index ]->diffAssoc ($ cachedResults ));
257+ // $this->assertTrue($cachedChunks['authors'][$index]->diffKeys($cachedResults)->isEmpty());
258+ // $this->assertTrue($uncachedChunks[$index]->diffKeys($cachedResults)->isEmpty());
259+
260+ $ this ->assertEmpty ($ cachedChunks ['authors ' ][$ index ]->diffKeys ($ cachedResults ));
261+ $ this ->assertEmpty ($ uncachedChunks [$ index ]->diffKeys ($ cachedResults ));
260262 }
261263 }
262264
@@ -302,8 +304,8 @@ public function testCursorModelResultsCreatesCache()
302304 ->cursor ()
303305 );
304306
305- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
306- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
307+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
308+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
307309 }
308310
309311 public function testFindModelResultsCreatesCache ()
@@ -318,8 +320,8 @@ public function testFindModelResultsCreatesCache()
318320 ->get ($ key ));
319321 $ liveResults = collect ()->push ((new UncachedAuthor )->find (1 ));
320322
321- $ this ->assertEmpty ($ author ->diffAssoc ($ cachedResults ));
322- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
323+ $ this ->assertEmpty ($ author ->diffKeys ($ cachedResults ));
324+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
323325 }
324326
325327 public function testGetModelResultsCreatesCache ()
@@ -339,7 +341,7 @@ public function testGetModelResultsCreatesCache()
339341 ->get ();
340342
341343 $ this ->assertEquals ($ authors , $ cachedResults );
342- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
344+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
343345 }
344346
345347 public function testMaxModelResultsCreatesCache ()
@@ -398,8 +400,8 @@ public function testPluckModelResultsCreatesCache()
398400 $ liveResults = (new UncachedAuthor )->with ('books ' , 'profile ' )
399401 ->pluck ('name ' , 'id ' );
400402
401- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
402- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
403+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
404+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
403405 }
404406
405407 public function testSumModelResultsCreatesCache ()
@@ -459,38 +461,38 @@ public function testNestedRelationshipEagerLoading()
459461 $ liveResults = collect ([(new UncachedAuthor )->with ('books.publisher ' )
460462 ->first ()]);
461463
462- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
463- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
464+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
465+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
464466 }
465467
466468 public function testLazyLoadedRelationshipResolvesThroughCachedBuilder ()
467469 {
468470 $ books = (new Author )->first ()->books ;
469- $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull_ ' );
471+ $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull ' );
470472 $ tags = [
471473 'genealabslaravelmodelcachingtestsfixturesbook ' ,
472474 ];
473475
474476 $ cachedResults = cache ()->tags ($ tags )->get ($ key );
475477 $ liveResults = (new UncachedAuthor )->first ()->books ;
476478
477- $ this ->assertEmpty ($ books ->diffAssoc ($ cachedResults ));
478- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
479+ $ this ->assertEmpty ($ books ->diffKeys ($ cachedResults ));
480+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
479481 }
480482
481483 public function testLazyLoadingOnResourceIsCached ()
482484 {
483485 $ books = (new AuthorResource ((new Author )->first ()))->books ;
484- $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull_ ' );
486+ $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull ' );
485487 $ tags = [
486488 'genealabslaravelmodelcachingtestsfixturesbook ' ,
487489 ];
488490
489491 $ cachedResults = cache ()->tags ($ tags )->get ($ key );
490492 $ liveResults = (new UncachedAuthor )->first ()->books ;
491493
492- $ this ->assertEmpty ($ books ->diffAssoc ($ cachedResults ));
493- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
494+ $ this ->assertEmpty ($ books ->diffKeys ($ cachedResults ));
495+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
494496 }
495497
496498 public function testOrderByClauseParsing ()
@@ -505,8 +507,8 @@ public function testOrderByClauseParsing()
505507 $ cachedResults = cache ()->tags ($ tags )->get ($ key );
506508 $ liveResults = (new UncachedAuthor )->orderBy ('name ' )->get ();
507509
508- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
509- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
510+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
511+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
510512 }
511513
512514 public function testNestedRelationshipWhereClauseParsing ()
@@ -527,8 +529,8 @@ public function testNestedRelationshipWhereClauseParsing()
527529 $ liveResults = (new UncachedAuthor )->with ('books.publisher ' )
528530 ->get ();
529531
530- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
531- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
532+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
533+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
532534 }
533535
534536 public function testExistsRelationshipWhereClauseParsing ()
@@ -543,8 +545,8 @@ public function testExistsRelationshipWhereClauseParsing()
543545 $ liveResults = (new UncachedAuthor )->whereHas ('books ' )
544546 ->get ();
545547
546- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
547- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
548+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
549+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
548550 }
549551
550552 public function testDoesntHaveWhereClauseParsing ()
@@ -563,8 +565,8 @@ public function testDoesntHaveWhereClauseParsing()
563565 ->doesntHave ('books ' )
564566 ->get ();
565567
566- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
567- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
568+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
569+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
568570 }
569571
570572 public function testColumnsRelationshipWhereClauseParsing ()
@@ -586,8 +588,8 @@ public function testColumnsRelationshipWhereClauseParsing()
586588 ->where ('name ' , '= ' , $ author ->name )
587589 ->get ();
588590
589- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
590- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
591+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
592+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
591593 }
592594
593595 public function testRawWhereClauseParsing ()
@@ -604,8 +606,8 @@ public function testRawWhereClauseParsing()
604606 $ liveResults = collect ([(new UncachedAuthor )
605607 ->whereRaw ('name <> \'\'' )->first ()]);
606608
607- $ this ->assertTrue ($ authors ->diffAssoc ($ cachedResults )->isEmpty ());
608- $ this ->assertTrue ($ liveResults ->diffAssoc ($ cachedResults )->isEmpty ());
609+ $ this ->assertTrue ($ authors ->diffKeys ($ cachedResults )->isEmpty ());
610+ $ this ->assertTrue ($ liveResults ->diffKeys ($ cachedResults )->isEmpty ());
609611 }
610612
611613 public function testScopeClauseParsing ()
@@ -635,7 +637,7 @@ public function testRelationshipQueriesAreCached()
635637 ->first ()
636638 ->books ()
637639 ->get ();
638- $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull_ ' );
640+ $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull ' );
639641 $ tags = [
640642 'genealabslaravelmodelcachingtestsfixturesbook '
641643 ];
@@ -646,8 +648,8 @@ public function testRelationshipQueriesAreCached()
646648 ->books ()
647649 ->get ();
648650
649- $ this ->assertTrue ($ cachedResults ->diffAssoc ($ books )->isEmpty ());
650- $ this ->assertTrue ($ liveResults ->diffAssoc ($ books )->isEmpty ());
651+ $ this ->assertTrue ($ cachedResults ->diffKeys ($ books )->isEmpty ());
652+ $ this ->assertTrue ($ liveResults ->diffKeys ($ books )->isEmpty ());
651653 }
652654
653655 public function testRawOrderByWithoutColumnReference ()
@@ -667,8 +669,8 @@ public function testRawOrderByWithoutColumnReference()
667669 ->orderByRaw ('DATE() ' )
668670 ->get ();
669671
670- $ this ->assertTrue ($ cachedResults ->diffAssoc ($ authors )->isEmpty ());
671- $ this ->assertTrue ($ liveResults ->diffAssoc ($ authors )->isEmpty ());
672+ $ this ->assertTrue ($ cachedResults ->diffKeys ($ authors )->isEmpty ());
673+ $ this ->assertTrue ($ liveResults ->diffKeys ($ authors )->isEmpty ());
672674 }
673675
674676 public function testDelete ()
@@ -717,8 +719,8 @@ private function processWhereClauseTestWithOperator(string $operator)
717719 ->where ('name ' , $ operator , $ author ->name )
718720 ->get ();
719721
720- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
721- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
722+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
723+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
722724 }
723725
724726 public function testWhereClauseParsingOfOperators ()
@@ -731,4 +733,24 @@ public function testWhereClauseParsingOfOperators()
731733 $ this ->processWhereClauseTestWithOperator ('LIKE ' );
732734 $ this ->processWhereClauseTestWithOperator ('NOT LIKE ' );
733735 }
736+
737+ public function testWhereBetweenResults ()
738+ {
739+ $ books = (new Book )
740+ ->whereBetween ('price ' , [5 , 10 ])
741+ ->get ();
742+ $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesbook-price_between_5_10 ' );
743+ $ tags = [
744+ 'genealabslaravelmodelcachingtestsfixturesbook ' ,
745+ ];
746+
747+ $ cachedResults = cache ()->tags ($ tags )
748+ ->get ($ key );
749+ $ liveResults = (new UncachedAuthor )
750+ ->whereBetween ('price ' , [5 , 10 ])
751+ ->get ();
752+
753+ $ this ->assertTrue ($ cachedResults ->diffKeys ($ books )->isEmpty ());
754+ $ this ->assertTrue ($ liveResults ->diffKeys ($ books )->isEmpty ());
755+ }
734756}
0 commit comments