File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
app/code/Magento/Analytics Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 88
99use Magento \Framework \App \Filesystem \DirectoryList ;
1010use Magento \Framework \Archive ;
11+ use Magento \Framework \Exception \FileSystemException ;
1112use Magento \Framework \Exception \LocalizedException ;
1213use Magento \Framework \Filesystem ;
1314use Magento \Framework \Filesystem \Directory \WriteInterface ;
@@ -89,8 +90,7 @@ public function __construct(
8990 public function prepareExportData ()
9091 {
9192 try {
92- $ tmpDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::SYS_TMP );
93-
93+ $ tmpDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::TMP );
9494 $ this ->prepareDirectory ($ tmpDirectory , $ this ->getTmpFilesDirRelativePath ());
9595 $ this ->reportWriter ->write ($ tmpDirectory , $ this ->getTmpFilesDirRelativePath ());
9696
@@ -106,8 +106,10 @@ public function prepareExportData()
106106 $ this ->cryptographer ->encode ($ tmpDirectory ->readFile ($ this ->getArchiveRelativePath ()))
107107 );
108108 } finally {
109- $ tmpDirectory ->delete ($ this ->getTmpFilesDirRelativePath ());
110- $ tmpDirectory ->delete ($ this ->getArchiveRelativePath ());
109+ if (isset ($ tmpDirectory )) {
110+ $ tmpDirectory ->delete ($ this ->getTmpFilesDirRelativePath ());
111+ $ tmpDirectory ->delete ($ this ->getArchiveRelativePath ());
112+ }
111113 }
112114
113115 return true ;
Original file line number Diff line number Diff line change 1515use Magento \Framework \Archive ;
1616use Magento \Framework \Filesystem ;
1717use Magento \Framework \Filesystem \Directory \WriteInterface ;
18- use Magento \Framework \Filesystem \DirectoryList ;
18+ use Magento \Framework \App \ Filesystem \DirectoryList ;
1919use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
2020use PHPUnit \Framework \MockObject \MockObject ;
2121use PHPUnit \Framework \TestCase ;
@@ -127,7 +127,7 @@ public function testPrepareExportData($isArchiveSourceDirectory)
127127 $ this ->filesystemMock
128128 ->expects ($ this ->once ())
129129 ->method ('getDirectoryWrite ' )
130- ->with (DirectoryList::SYS_TMP )
130+ ->with (DirectoryList::TMP )
131131 ->willReturn ($ this ->directoryMock );
132132 $ this ->directoryMock
133133 ->expects ($ this ->exactly (4 ))
@@ -228,7 +228,7 @@ public function testPrepareExportDataWithLocalizedException()
228228 $ this ->filesystemMock
229229 ->expects ($ this ->once ())
230230 ->method ('getDirectoryWrite ' )
231- ->with (DirectoryList::SYS_TMP )
231+ ->with (DirectoryList::TMP )
232232 ->willReturn ($ this ->directoryMock );
233233 $ this ->reportWriterMock
234234 ->expects ($ this ->once ())
You can’t perform that action at this time.
0 commit comments