@@ -137,7 +137,7 @@ public function testHasManyRelationshipIsCached()
137
137
->get (sha1 ("genealabslaravelmodelcachingtestsfixturesauthor-books " )));
138
138
139
139
$ this ->assertNotNull ($ results );
140
- $ this ->assertEmpty ($ authors ->diffAssoc ($ results ));
140
+ $ this ->assertEmpty ($ authors ->diffKeys ($ results ));
141
141
$ this ->assertNotEmpty ($ authors );
142
142
$ this ->assertNotEmpty ($ results );
143
143
$ this ->assertEquals ($ authors ->count (), $ results ->count ());
@@ -154,7 +154,7 @@ public function testBelongsToRelationshipIsCached()
154
154
->get (sha1 ("genealabslaravelmodelcachingtestsfixturesbook-author " )));
155
155
156
156
$ this ->assertNotNull ($ results );
157
- $ this ->assertEmpty ($ books ->diffAssoc ($ results ));
157
+ $ this ->assertEmpty ($ books ->diffKeys ($ results ));
158
158
$ this ->assertNotEmpty ($ books );
159
159
$ this ->assertNotEmpty ($ results );
160
160
$ this ->assertEquals ($ books ->count (), $ results ->count ());
@@ -171,7 +171,7 @@ public function testBelongsToManyRelationshipIsCached()
171
171
->get (sha1 ("genealabslaravelmodelcachingtestsfixturesbook-stores " )));
172
172
173
173
$ this ->assertNotNull ($ results );
174
- $ this ->assertEmpty ($ books ->diffAssoc ($ results ));
174
+ $ this ->assertEmpty ($ books ->diffKeys ($ results ));
175
175
$ this ->assertNotEmpty ($ books );
176
176
$ this ->assertNotEmpty ($ results );
177
177
$ this ->assertEquals ($ books ->count (), $ results ->count ());
@@ -189,7 +189,7 @@ public function testHasOneRelationshipIsCached()
189
189
->get (sha1 ("genealabslaravelmodelcachingtestsfixturesauthor-profile " )));
190
190
191
191
$ this ->assertNotNull ($ results );
192
- $ this ->assertEmpty ($ authors ->diffAssoc ($ results ));
192
+ $ this ->assertEmpty ($ authors ->diffKeys ($ results ));
193
193
$ this ->assertNotEmpty ($ authors );
194
194
$ this ->assertNotEmpty ($ results );
195
195
$ this ->assertEquals ($ authors ->count (), $ results ->count ());
@@ -240,8 +240,7 @@ public function testChunkModelResultsCreatesCache()
240
240
241
241
$ cachedChunks ['authors ' ]->push ($ chunk );
242
242
$ 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 "
245
244
));
246
245
});
247
246
@@ -255,8 +254,11 @@ public function testChunkModelResultsCreatesCache()
255
254
$ cachedResults = cache ()->tags ($ tags )
256
255
->get ($ key );
257
256
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 ));
260
262
}
261
263
}
262
264
@@ -302,8 +304,8 @@ public function testCursorModelResultsCreatesCache()
302
304
->cursor ()
303
305
);
304
306
305
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
306
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
307
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
308
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
307
309
}
308
310
309
311
public function testFindModelResultsCreatesCache ()
@@ -318,8 +320,8 @@ public function testFindModelResultsCreatesCache()
318
320
->get ($ key ));
319
321
$ liveResults = collect ()->push ((new UncachedAuthor )->find (1 ));
320
322
321
- $ this ->assertEmpty ($ author ->diffAssoc ($ cachedResults ));
322
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
323
+ $ this ->assertEmpty ($ author ->diffKeys ($ cachedResults ));
324
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
323
325
}
324
326
325
327
public function testGetModelResultsCreatesCache ()
@@ -339,7 +341,7 @@ public function testGetModelResultsCreatesCache()
339
341
->get ();
340
342
341
343
$ this ->assertEquals ($ authors , $ cachedResults );
342
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
344
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
343
345
}
344
346
345
347
public function testMaxModelResultsCreatesCache ()
@@ -398,8 +400,8 @@ public function testPluckModelResultsCreatesCache()
398
400
$ liveResults = (new UncachedAuthor )->with ('books ' , 'profile ' )
399
401
->pluck ('name ' , 'id ' );
400
402
401
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
402
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
403
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
404
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
403
405
}
404
406
405
407
public function testSumModelResultsCreatesCache ()
@@ -459,38 +461,38 @@ public function testNestedRelationshipEagerLoading()
459
461
$ liveResults = collect ([(new UncachedAuthor )->with ('books.publisher ' )
460
462
->first ()]);
461
463
462
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
463
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
464
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
465
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
464
466
}
465
467
466
468
public function testLazyLoadedRelationshipResolvesThroughCachedBuilder ()
467
469
{
468
470
$ 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 ' );
470
472
$ tags = [
471
473
'genealabslaravelmodelcachingtestsfixturesbook ' ,
472
474
];
473
475
474
476
$ cachedResults = cache ()->tags ($ tags )->get ($ key );
475
477
$ liveResults = (new UncachedAuthor )->first ()->books ;
476
478
477
- $ this ->assertEmpty ($ books ->diffAssoc ($ cachedResults ));
478
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
479
+ $ this ->assertEmpty ($ books ->diffKeys ($ cachedResults ));
480
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
479
481
}
480
482
481
483
public function testLazyLoadingOnResourceIsCached ()
482
484
{
483
485
$ 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 ' );
485
487
$ tags = [
486
488
'genealabslaravelmodelcachingtestsfixturesbook ' ,
487
489
];
488
490
489
491
$ cachedResults = cache ()->tags ($ tags )->get ($ key );
490
492
$ liveResults = (new UncachedAuthor )->first ()->books ;
491
493
492
- $ this ->assertEmpty ($ books ->diffAssoc ($ cachedResults ));
493
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
494
+ $ this ->assertEmpty ($ books ->diffKeys ($ cachedResults ));
495
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
494
496
}
495
497
496
498
public function testOrderByClauseParsing ()
@@ -505,8 +507,8 @@ public function testOrderByClauseParsing()
505
507
$ cachedResults = cache ()->tags ($ tags )->get ($ key );
506
508
$ liveResults = (new UncachedAuthor )->orderBy ('name ' )->get ();
507
509
508
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
509
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
510
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
511
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
510
512
}
511
513
512
514
public function testNestedRelationshipWhereClauseParsing ()
@@ -527,8 +529,8 @@ public function testNestedRelationshipWhereClauseParsing()
527
529
$ liveResults = (new UncachedAuthor )->with ('books.publisher ' )
528
530
->get ();
529
531
530
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
531
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
532
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
533
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
532
534
}
533
535
534
536
public function testExistsRelationshipWhereClauseParsing ()
@@ -543,8 +545,8 @@ public function testExistsRelationshipWhereClauseParsing()
543
545
$ liveResults = (new UncachedAuthor )->whereHas ('books ' )
544
546
->get ();
545
547
546
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
547
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
548
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
549
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
548
550
}
549
551
550
552
public function testDoesntHaveWhereClauseParsing ()
@@ -563,8 +565,8 @@ public function testDoesntHaveWhereClauseParsing()
563
565
->doesntHave ('books ' )
564
566
->get ();
565
567
566
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
567
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
568
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
569
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
568
570
}
569
571
570
572
public function testColumnsRelationshipWhereClauseParsing ()
@@ -586,8 +588,8 @@ public function testColumnsRelationshipWhereClauseParsing()
586
588
->where ('name ' , '= ' , $ author ->name )
587
589
->get ();
588
590
589
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
590
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
591
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
592
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
591
593
}
592
594
593
595
public function testRawWhereClauseParsing ()
@@ -604,8 +606,8 @@ public function testRawWhereClauseParsing()
604
606
$ liveResults = collect ([(new UncachedAuthor )
605
607
->whereRaw ('name <> \'\'' )->first ()]);
606
608
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 ());
609
611
}
610
612
611
613
public function testScopeClauseParsing ()
@@ -635,7 +637,7 @@ public function testRelationshipQueriesAreCached()
635
637
->first ()
636
638
->books ()
637
639
->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 ' );
639
641
$ tags = [
640
642
'genealabslaravelmodelcachingtestsfixturesbook '
641
643
];
@@ -646,8 +648,8 @@ public function testRelationshipQueriesAreCached()
646
648
->books ()
647
649
->get ();
648
650
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 ());
651
653
}
652
654
653
655
public function testRawOrderByWithoutColumnReference ()
@@ -667,8 +669,8 @@ public function testRawOrderByWithoutColumnReference()
667
669
->orderByRaw ('DATE() ' )
668
670
->get ();
669
671
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 ());
672
674
}
673
675
674
676
public function testDelete ()
@@ -717,8 +719,8 @@ private function processWhereClauseTestWithOperator(string $operator)
717
719
->where ('name ' , $ operator , $ author ->name )
718
720
->get ();
719
721
720
- $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
721
- $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
722
+ $ this ->assertEmpty ($ authors ->diffKeys ($ cachedResults ));
723
+ $ this ->assertEmpty ($ liveResults ->diffKeys ($ cachedResults ));
722
724
}
723
725
724
726
public function testWhereClauseParsingOfOperators ()
@@ -731,4 +733,24 @@ public function testWhereClauseParsingOfOperators()
731
733
$ this ->processWhereClauseTestWithOperator ('LIKE ' );
732
734
$ this ->processWhereClauseTestWithOperator ('NOT LIKE ' );
733
735
}
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
+ }
734
756
}
0 commit comments