Skip to content

Commit 1a34055

Browse files
committed
MC-33069: Stabilize Unit tests
1 parent 81e3240 commit 1a34055

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ public function getReportAbsolutePath($fileName)
111111
* Retrieve report file size
112112
*
113113
* @param string $filename
114-
* @return int|mixed
114+
* @return int|null
115115
*/
116116
public function getReportSize($filename)
117117
{
118-
return $this->varDirectory->stat($this->getFilePath($filename))['size'];
118+
$statResult = $this->varDirectory->stat($this->getFilePath($filename));
119+
120+
return $statResult['size'] ?? null;
119121
}
120122

121123
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ protected function setUp(): void
9393
$this->varDirectory->expects($this->any())->method('getRelativePath')->willReturn('path');
9494
$this->varDirectory->expects($this->any())->method('readFile')->willReturn('contents');
9595
$this->varDirectory->expects($this->any())->method('isFile')->willReturn(true);
96-
$this->varDirectory->expects($this->any())->method('stat')->willReturn(100);
96+
$this->varDirectory->expects($this->any())->method('stat')->willReturn(false);
9797
$this->filesystem->expects($this->any())->method('getDirectoryWrite')->willReturn($this->varDirectory);
9898
$this->objectManagerHelper = new ObjectManagerHelper($this);
9999
$this->report = $this->objectManagerHelper->getObject(

0 commit comments

Comments
 (0)