@@ -2745,6 +2745,98 @@ public function testFindUpdatedAfter(): void
27452745 $ this ->assertEquals (0 , count ($ documents ));
27462746 }
27472747
2748+ public function testFindCreatedBetween (): void
2749+ {
2750+ /** @var Database $database */
2751+ $ database = static ::getDatabase ();
2752+
2753+ /**
2754+ * Test Query::createdBetween wrapper
2755+ */
2756+ $ pastDate = '1900-01-01T00:00:00.000Z ' ;
2757+ $ futureDate = '2050-01-01T00:00:00.000Z ' ;
2758+ $ recentPastDate = '2020-01-01T00:00:00.000Z ' ;
2759+ $ nearFutureDate = '2025-01-01T00:00:00.000Z ' ;
2760+
2761+ // All documents should be between past and future
2762+ $ documents = $ database ->find ('movies ' , [
2763+ Query::createdBetween ($ pastDate , $ futureDate ),
2764+ Query::limit (25 )
2765+ ]);
2766+
2767+ $ this ->assertGreaterThan (0 , count ($ documents ));
2768+
2769+ // No documents should exist in this range
2770+ $ documents = $ database ->find ('movies ' , [
2771+ Query::createdBetween ($ pastDate , $ pastDate ),
2772+ Query::limit (25 )
2773+ ]);
2774+
2775+ $ this ->assertEquals (0 , count ($ documents ));
2776+
2777+ // Documents created between recent past and near future
2778+ $ documents = $ database ->find ('movies ' , [
2779+ Query::createdBetween ($ recentPastDate , $ nearFutureDate ),
2780+ Query::limit (25 )
2781+ ]);
2782+
2783+ $ count = count ($ documents );
2784+
2785+ // Same count should be returned with expanded range
2786+ $ documents = $ database ->find ('movies ' , [
2787+ Query::createdBetween ($ pastDate , $ nearFutureDate ),
2788+ Query::limit (25 )
2789+ ]);
2790+
2791+ $ this ->assertGreaterThanOrEqual ($ count , count ($ documents ));
2792+ }
2793+
2794+ public function testFindUpdatedBetween (): void
2795+ {
2796+ /** @var Database $database */
2797+ $ database = static ::getDatabase ();
2798+
2799+ /**
2800+ * Test Query::updatedBetween wrapper
2801+ */
2802+ $ pastDate = '1900-01-01T00:00:00.000Z ' ;
2803+ $ futureDate = '2050-01-01T00:00:00.000Z ' ;
2804+ $ recentPastDate = '2020-01-01T00:00:00.000Z ' ;
2805+ $ nearFutureDate = '2025-01-01T00:00:00.000Z ' ;
2806+
2807+ // All documents should be between past and future
2808+ $ documents = $ database ->find ('movies ' , [
2809+ Query::updatedBetween ($ pastDate , $ futureDate ),
2810+ Query::limit (25 )
2811+ ]);
2812+
2813+ $ this ->assertGreaterThan (0 , count ($ documents ));
2814+
2815+ // No documents should exist in this range
2816+ $ documents = $ database ->find ('movies ' , [
2817+ Query::updatedBetween ($ pastDate , $ pastDate ),
2818+ Query::limit (25 )
2819+ ]);
2820+
2821+ $ this ->assertEquals (0 , count ($ documents ));
2822+
2823+ // Documents updated between recent past and near future
2824+ $ documents = $ database ->find ('movies ' , [
2825+ Query::updatedBetween ($ recentPastDate , $ nearFutureDate ),
2826+ Query::limit (25 )
2827+ ]);
2828+
2829+ $ count = count ($ documents );
2830+
2831+ // Same count should be returned with expanded range
2832+ $ documents = $ database ->find ('movies ' , [
2833+ Query::updatedBetween ($ pastDate , $ nearFutureDate ),
2834+ Query::limit (25 )
2835+ ]);
2836+
2837+ $ this ->assertGreaterThanOrEqual ($ count , count ($ documents ));
2838+ }
2839+
27482840 public function testFindLimit (): void
27492841 {
27502842 /** @var Database $database */
0 commit comments