@@ -278,7 +278,7 @@ public function testPrepareSummary($useAggregatedData, $mainTable, $isFilter, $g
278278 * @param int $range
279279 * @param string $customStart
280280 * @param string $customEnd
281- * @param string $expectedInterval
281+ * @param array $expectedInterval
282282 *
283283 * @return void
284284 * @dataProvider firstPartDateRangeDataProvider
@@ -288,20 +288,7 @@ public function testGetDateRangeFirstPart($range, $customStart, $customEnd, $exp
288288 $ result = $ this ->collection ->getDateRange ($ range , $ customStart , $ customEnd );
289289 $ interval = $ result ['to ' ]->diff ($ result ['from ' ]);
290290 $ intervalResult = $ interval ->format ('%y %m %d %h:%i:%s ' );
291- if ($ intervalResult !== $ expectedInterval ) {
292- $ result ['from ' ]->setTimezone (new \DateTimeZone ('America/Chicago ' ));
293- $ result ['to ' ]->setTimezone (new \DateTimeZone ('America/Chicago ' ));
294- //Daylight saving check
295- if (!date ('I ' , strtotime ($ result ['from ' ]->format ('Y-m-d H:i:s ' )))) {
296- //when the start date does not fall during Daylight saving but the end date falls
297- $ this ->assertEquals (strtotime ($ expectedInterval .' +1 hours ' ), strtotime ($ intervalResult ));
298- } elseif (!date ('I ' , strtotime ($ result ['to ' ]->format ('Y-m-d H:i:s ' )))) {
299- //when the end date does not fall during Daylight saving but the start date falls
300- $ this ->assertEquals (strtotime ($ expectedInterval .' -1 hours ' ), strtotime ($ intervalResult ));
301- }
302- } else {
303- $ this ->assertEquals ($ expectedInterval , $ intervalResult );
304- }
291+ $ this ->assertContains ($ intervalResult , $ expectedInterval );
305292 }
306293
307294 /**
@@ -474,9 +461,9 @@ public function useAggregatedDataDataProvider(): array
474461 public function firstPartDateRangeDataProvider (): array
475462 {
476463 return [
477- ['' , '' , '' , '0 0 0 23:59:59 ' ],
478- ['24h ' , '' , '' , '0 0 1 0:0:0 ' ],
479- ['7d ' , '' , '' , '0 0 6 23:59:59 ' ]
464+ ['' , '' , '' , [ '0 0 0 23:59:59 ' , ' 0 0 1 0:59:59 ' , ' 0 0 0 22:59:59 ' ] ],
465+ ['24h ' , '' , '' , [ '0 0 1 0:0:0 ' , ' 0 0 1 1:0:0 ' , ' 0 0 0 23:0:0 ' ] ],
466+ ['7d ' , '' , '' , [ '0 0 6 23:59:59 ' , ' 0 0 7 0:59:59 ' , ' 0 0 6 22:59:59 ' ] ]
480467 ];
481468 }
482469
0 commit comments