@@ -278,7 +278,7 @@ public function testPrepareSummary($useAggregatedData, $mainTable, $isFilter, $g
278
278
* @param int $range
279
279
* @param string $customStart
280
280
* @param string $customEnd
281
- * @param string $expectedInterval
281
+ * @param array $expectedInterval
282
282
*
283
283
* @return void
284
284
* @dataProvider firstPartDateRangeDataProvider
@@ -288,20 +288,7 @@ public function testGetDateRangeFirstPart($range, $customStart, $customEnd, $exp
288
288
$ result = $ this ->collection ->getDateRange ($ range , $ customStart , $ customEnd );
289
289
$ interval = $ result ['to ' ]->diff ($ result ['from ' ]);
290
290
$ 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 );
305
292
}
306
293
307
294
/**
@@ -474,9 +461,9 @@ public function useAggregatedDataDataProvider(): array
474
461
public function firstPartDateRangeDataProvider (): array
475
462
{
476
463
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 ' ] ]
480
467
];
481
468
}
482
469
0 commit comments