File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
app/code/Magento/TaxImportExport
Controller/Adminhtml/Rate
Test/Unit/Controller/Adminhtml/Rate Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff 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 /**
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments