Skip to content

Commit b0801cd

Browse files
author
Vladyslav Shcherbyna
committed
MAGETWO-44815: L1, L2 are red on mainline
1 parent 8ee7056 commit b0801cd

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Order/CollectionTest.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,13 @@ public function testPrepareSummary($useAggregatedData, $mainTable, $isFilter, $g
251251
*/
252252
public function testGetDateRangeFirstPart($range, $customStart, $customEnd, $expectedInterval)
253253
{
254+
$timeZoneToReturn = date_default_timezone_get();
255+
date_default_timezone_set('UTC');
254256
$result = $this->collection->getDateRange($range, $customStart, $customEnd);
255257
$interval = $result['to']->diff($result['from']);
258+
date_default_timezone_set($timeZoneToReturn);
256259
$intervalResult = $interval->format('%y %m %d %h:%i:%s');
257-
$this->assertEquals($expectedInterval->format('%y %m %d %h:%i:%s'), $intervalResult);
260+
$this->assertEquals($expectedInterval, $intervalResult);
258261
}
259262

260263
/**
@@ -423,15 +426,10 @@ public function useAggregatedDataDataProvider()
423426
*/
424427
public function firstPartDateRangeDataProvider()
425428
{
426-
$dt = new \DateTime();
427-
$dt->setTime(0, 0, 0);
428-
$dt1 = clone $dt;
429-
$dt2 = clone $dt;
430-
$dt3 = clone $dt;
431429
return [
432-
['', '', '', $dt->diff($dt1->setTime(23, 59, 59))],
433-
['24h', '', '', $dt->diff($dt2->add(new \DateInterval('P0Y0M01DT00H00M00S')))],
434-
['7d', '', '', $dt->diff($dt3->add(new \DateInterval('P0Y0M06DT23H59M59S')))]
430+
['', '', '', '0 0 0 23:59:59'],
431+
['24h', '', '', '0 0 1 0:0:0'],
432+
['7d', '', '', '0 0 6 23:59:59']
435433
];
436434
}
437435

0 commit comments

Comments
 (0)