File tree Expand file tree Collapse file tree 4 files changed +68
-8
lines changed
Controller/Adminhtml/Report/Product
Test/Integration/Controller/Adminhtml/Report/Product Expand file tree Collapse file tree 4 files changed +68
-8
lines changed Original file line number Diff line number Diff line change 11<?php
22/**
3- *
43 * Copyright © Magento, Inc. All rights reserved.
54 * See COPYING.txt for license details.
65 */
6+ declare (strict_types=1 );
7+
78namespace Magento \Reports \Controller \Adminhtml \Report \Product ;
89
10+ use Magento \Framework \App \Filesystem \DirectoryList ;
911use Magento \Framework \App \ResponseInterface ;
12+ use Magento \Reports \Controller \Adminhtml \Report \Product ;
1013
11- class ExportDownloadsCsv extends \Magento \Reports \Controller \Adminhtml \Report \Product
14+ /**
15+ * Exporting list of product in CVS format.
16+ *
17+ * @SuppressWarnings(PHPMD.AllPurposeAction)
18+ */
19+ class ExportDownloadsCsv extends Product
1220{
1321 /**
1422 * Authorization level of a basic admin session
1523 *
1624 * @see _isAllowed()
1725 */
18- const ADMIN_RESOURCE = 'Magento_Reports::report_products ' ;
26+ public const ADMIN_RESOURCE = 'Magento_Reports::report_products ' ;
1927
2028 /**
2129 * Export products downloads report to CSV format
@@ -31,6 +39,6 @@ public function execute()
3139 true
3240 )->getCsv ();
3341
34- return $ this ->_fileFactory ->create ($ fileName , $ content );
42+ return $ this ->_fileFactory ->create ($ fileName , $ content, DirectoryList:: VAR_DIR );
3543 }
3644}
Original file line number Diff line number Diff line change 11<?php
22/**
3- *
43 * Copyright © Magento, Inc. All rights reserved.
54 * See COPYING.txt for license details.
65 */
6+ declare (strict_types=1 );
7+
78namespace Magento \Reports \Controller \Adminhtml \Report \Product ;
89
10+ use Magento \Framework \App \Filesystem \DirectoryList ;
911use Magento \Framework \App \ResponseInterface ;
12+ use Magento \Reports \Controller \Adminhtml \Report \Product ;
1013
11- class ExportDownloadsExcel extends \Magento \Reports \Controller \Adminhtml \Report \Product
14+ /**
15+ * Exporting list of product in Excel format.
16+ *
17+ * @SuppressWarnings(PHPMD.AllPurposeAction)
18+ */
19+ class ExportDownloadsExcel extends Product
1220{
1321 /**
1422 * Authorization level of a basic admin session
1523 *
1624 * @see _isAllowed()
1725 */
18- const ADMIN_RESOURCE = 'Magento_Reports::report_products ' ;
26+ public const ADMIN_RESOURCE = 'Magento_Reports::report_products ' ;
1927
2028 /**
2129 * Export products downloads report to XLS format
@@ -33,6 +41,6 @@ public function execute()
3341 $ fileName
3442 );
3543
36- return $ this ->_fileFactory ->create ($ fileName , $ content );
44+ return $ this ->_fileFactory ->create ($ fileName , $ content, DirectoryList:: VAR_DIR );
3745 }
3846}
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+ declare (strict_types=1 );
7+
8+ namespace Magento \Reports \Test \Integration \Controller \Adminhtml \Report \Product ;
9+
10+ use Magento \TestFramework \TestCase \AbstractBackendController ;
11+
12+ /**
13+ * @magentoAppArea adminhtml
14+ */
15+ class ExportDownloadsCsvTest extends AbstractBackendController
16+ {
17+ public function testExecute ()
18+ {
19+ $ this ->dispatch ('backend/reports/report_product/exportDownloadsCsv ' );
20+ $ this ->assertEquals (302 , $ this ->getResponse ()->getHttpResponseCode ());
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+ declare (strict_types=1 );
7+
8+ namespace Magento \Reports \Test \Integration \Controller \Adminhtml \Report \Product ;
9+
10+ use Magento \TestFramework \TestCase \AbstractBackendController ;
11+
12+ /**
13+ * @magentoAppArea adminhtml
14+ */
15+ class ExportDownloadsExcelTest extends AbstractBackendController
16+ {
17+ public function testExecute ()
18+ {
19+ $ this ->dispatch ('backend/reports/report_product/exportDownloadsExcel ' );
20+ $ this ->assertEquals (302 , $ this ->getResponse ()->getHttpResponseCode ());
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments