Skip to content

Commit c662744

Browse files
authored
MC-37822: Support by TaxImportExport (#6269)
1 parent 362eba8 commit c662744

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate/ExportPost.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ public function execute()
8181

8282
$content .= $rate->toString($template) . "\n";
8383
}
84-
return $this->fileFactory->create('tax_rates.csv', $content, DirectoryList::VAR_DIR);
84+
// pass 'rm' parameter to delete a file after download
85+
$fileContent = ['type' => 'string', 'value' => $content, 'rm' => true];
86+
87+
return $this->fileFactory->create('tax_rates.csv', $fileContent, DirectoryList::VAR_DIR);
8588
}
8689

8790
/**

app/code/Magento/TaxImportExport/Test/Unit/Controller/Adminhtml/Rate/ExportPostTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ public function testExecute()
101101
]);
102102
$rateCollectionMock->expects($this->once())->method('joinCountryTable')->willReturnSelf();
103103
$rateCollectionMock->expects($this->once())->method('joinRegionTable')->willReturnSelf();
104+
$fileContent = ['type' => 'string', 'value' => $content, 'rm' => true];
104105
$this->fileFactoryMock
105106
->expects($this->once())
106107
->method('create')
107-
->with('tax_rates.csv', $content, DirectoryList::VAR_DIR);
108+
->with('tax_rates.csv', $fileContent, DirectoryList::VAR_DIR);
108109
$this->controller->execute();
109110
}
110111
}

0 commit comments

Comments
 (0)