Skip to content

Commit 3e19c90

Browse files
committed
MC-15448: One can't download or delete export csv file from export index page grid
1 parent 8c45abb commit 3e19c90

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

app/code/Magento/ImportExport/Controller/Adminhtml/Export.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,4 @@ abstract class Export extends Action
1818
* @see _isAllowed()
1919
*/
2020
const ADMIN_RESOURCE = 'Magento_ImportExport::export';
21-
22-
/**
23-
* @inheritdoc
24-
*/
25-
protected $_publicActions = ['download', 'delete'];
2621
}

app/code/Magento/ImportExport/Controller/Adminhtml/Export/File/Delete.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class Delete extends ExportController implements HttpGetActionInterface
3737
*/
3838
private $file;
3939

40+
/**
41+
* @inheritdoc
42+
*/
43+
protected $_publicActions = ['delete'];
44+
4045
/**
4146
* Delete constructor.
4247
* @param Action\Context $context

app/code/Magento/ImportExport/Controller/Adminhtml/Export/File/Download.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class Download extends ExportController implements HttpGetActionInterface
3535
*/
3636
private $filesystem;
3737

38+
/**
39+
* @inheritdoc
40+
*/
41+
protected $_publicActions = ['download'];
42+
3843
/**
3944
* DownloadFile constructor.
4045
* @param Action\Context $context

dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DeleteTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@
88
namespace Magento\ImportExport\Controller\Adminhtml\Export\File;
99

1010
use Magento\Framework\App\Filesystem\DirectoryList;
11+
use Magento\Framework\Filesystem;
12+
use Magento\ImportExport\Controller\Adminhtml\Export\File\Delete;
13+
use Magento\TestFramework\Helper\Bootstrap;
1114

1215
/**
1316
* Test for \Magento\ImportExport\Controller\Adminhtml\Export\File\Delete class.
1417
*/
1518
class DeleteTest extends \PHPUnit\Framework\TestCase
1619
{
1720
/**
18-
* @var \Magento\ImportExport\Controller\Adminhtml\Export\File\Delete
21+
* @var Delete
1922
*/
2023
private $model;
2124

@@ -35,7 +38,7 @@ class DeleteTest extends \PHPUnit\Framework\TestCase
3538
private $fileName = 'catalog_product.csv';
3639

3740
/**
38-
* @var \Magento\Framework\Filesystem
41+
* @var Filesystem
3942
*/
4043
private $filesystem;
4144

@@ -49,15 +52,15 @@ class DeleteTest extends \PHPUnit\Framework\TestCase
4952
*/
5053
protected function setUp()
5154
{
52-
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
53-
$this->filesystem = $this->objectManager->get(\Magento\Framework\Filesystem::class);
55+
$this->objectManager = Bootstrap::getObjectManager();
56+
$this->filesystem = $this->objectManager->get(Filesystem::class);
5457
$this->varDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
5558
$this->varDirectory->create($this->varDirectory->getRelativePath('export'));
5659
$this->fullDirectoryPath = $this->varDirectory->getAbsolutePath('export');
5760
$filePath = $this->fullDirectoryPath . DIRECTORY_SEPARATOR . $this->fileName;
5861
$fixtureDir = realpath(__DIR__ . '/../../Import/_files');
5962
copy($fixtureDir . '/' . $this->fileName, $filePath);
60-
$this->model = $this->objectManager->get(\Magento\ImportExport\Controller\Adminhtml\Export\File\Delete::class);
63+
$this->model = $this->objectManager->get(Delete::class);
6164
}
6265

6366
/**
@@ -71,9 +74,7 @@ public function testExecute()
7174
$this->model->execute();
7275

7376
$this->assertFalse(
74-
$this->varDirectory->isExist(
75-
$this->varDirectory->getRelativePath( 'export/' . $this->fileName)
76-
)
77+
$this->varDirectory->isExist($this->varDirectory->getRelativePath('export/' . $this->fileName))
7778
);
7879
}
7980

@@ -82,8 +83,7 @@ public function testExecute()
8283
*/
8384
public static function tearDownAfterClass()
8485
{
85-
$filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
86-
->get(\Magento\Framework\Filesystem::class);
86+
$filesystem = Bootstrap::getObjectManager()->get(Filesystem::class);
8787
/** @var \Magento\Framework\Filesystem\Directory\WriteInterface $directory */
8888
$directory = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
8989
if ($directory->isExist('export')) {

0 commit comments

Comments
 (0)