Skip to content

Commit 34c4af5

Browse files
committed
MAGETWO-94206: [2.3] [Magento cloud] Import history wrong execution time
1 parent 1a968e0 commit 34c4af5

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

app/code/Magento/ImportExport/Helper/Report.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function __construct(
5252
*/
5353
public function getExecutionTime($time)
5454
{
55-
$reportTime = $this->timeZone->date($time, $this->timeZone->getConfigTimezone());
55+
$reportTime = $this->timeZone->date($time);
5656
$timeDiff = $reportTime->diff($this->timeZone->date());
57-
return $timeDiff->format('%H:%M:%S');
57+
return $timeDiff->format('%H:%I:%S');
5858
}
5959

6060
/**

app/code/Magento/ImportExport/Test/Unit/Helper/ReportTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,17 @@ protected function setUp()
8989
*/
9090
public function testGetExecutionTime()
9191
{
92-
$time = '01:02:03';
93-
$this->timezone->expects($this->any())->method('date')->willReturnSelf();
94-
$this->timezone->expects($this->any())->method('getConfigTimezone')->willReturn('America/Los_Angeles');
95-
$this->timezone->expects($this->any())->method('diff')->willReturnSelf();
96-
$this->timezone->expects($this->any())->method('format')->willReturn($time);
97-
$this->assertEquals($time, $this->report->getExecutionTime($time));
92+
$startDate = '2000-01-01 01:01:01';
93+
$endDate = '2000-01-01 02:03:04';
94+
$executionTime = '01:02:03';
95+
96+
$startDateMock = $this->createTestProxy(\DateTime::class, ['time' => $startDate]);
97+
$endDateMock = $this->createTestProxy(\DateTime::class, ['time' => $endDate]);
98+
$this->timezone->method('date')
99+
->withConsecutive([$startDate], [])
100+
->willReturnOnConsecutiveCalls($startDateMock, $endDateMock);
101+
102+
$this->assertEquals($executionTime, $this->report->getExecutionTime($startDate));
98103
}
99104

100105
/**

0 commit comments

Comments
 (0)