Skip to content

Commit 2abdcd4

Browse files
committed
MC-30066: Temporary files are not deleted after exporting products
1 parent c89a184 commit 2abdcd4

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Framework\App\Bootstrap;
99
use Magento\Framework\App\Filesystem\DirectoryList;
10+
use Magento\ImportExport\Model\Export\Adapter\AbstractAdapter;
1011
use Magento\Store\Model\Store;
1112

1213
/**
@@ -62,6 +63,11 @@ abstract class AbstractProductExportImportTestCase extends \PHPUnit\Framework\Te
6263
'tax_class_id',
6364
];
6465

66+
/**
67+
* @var AbstractAdapter
68+
*/
69+
private $writer;
70+
6571
/**
6672
* @inheritdoc
6773
*/
@@ -367,7 +373,7 @@ protected function executeImportReplaceTest(
367373
* Export products in the system.
368374
*
369375
* @param \Magento\CatalogImportExport\Model\Export\Product|null $exportProduct
370-
* @return string Return exported file name
376+
* @return string Return exported file
371377
*/
372378
private function exportProducts(\Magento\CatalogImportExport\Model\Export\Product $exportProduct = null)
373379
{
@@ -376,12 +382,11 @@ private function exportProducts(\Magento\CatalogImportExport\Model\Export\Produc
376382
$exportProduct = $exportProduct ?: $this->objectManager->create(
377383
\Magento\CatalogImportExport\Model\Export\Product::class
378384
);
379-
$exportProduct->setWriter(
380-
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
381-
\Magento\ImportExport\Model\Export\Adapter\Csv::class,
382-
['fileSystem' => $this->fileSystem, 'destination' => $csvfile]
383-
)
385+
$this->writer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
386+
\Magento\ImportExport\Model\Export\Adapter\Csv::class,
387+
['fileSystem' => $this->fileSystem, 'destination' => $csvfile]
384388
);
389+
$exportProduct->setWriter($this->writer);
385390
$this->assertNotEmpty($exportProduct->export());
386391

387392
return $csvfile;

0 commit comments

Comments
 (0)