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()
81
81
82
82
$ content .= $ rate ->toString ($ template ) . "\n" ;
83
83
}
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 );
85
88
}
86
89
87
90
/**
Original file line number Diff line number Diff line change @@ -101,10 +101,11 @@ public function testExecute()
101
101
]);
102
102
$ rateCollectionMock ->expects ($ this ->once ())->method ('joinCountryTable ' )->willReturnSelf ();
103
103
$ rateCollectionMock ->expects ($ this ->once ())->method ('joinRegionTable ' )->willReturnSelf ();
104
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ content , 'rm ' => true ];
104
105
$ this ->fileFactoryMock
105
106
->expects ($ this ->once ())
106
107
->method ('create ' )
107
- ->with ('tax_rates.csv ' , $ content , DirectoryList::VAR_DIR );
108
+ ->with ('tax_rates.csv ' , $ fileContent , DirectoryList::VAR_DIR );
108
109
$ this ->controller ->execute ();
109
110
}
110
111
}
You can’t perform that action at this time.
0 commit comments