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 1
1
<?php
2
2
/**
3
- *
4
3
* Copyright © Magento, Inc. All rights reserved.
5
4
* See COPYING.txt for license details.
6
5
*/
6
+ declare (strict_types=1 );
7
+
7
8
namespace Magento \Reports \Controller \Adminhtml \Report \Product ;
8
9
10
+ use Magento \Framework \App \Filesystem \DirectoryList ;
9
11
use Magento \Framework \App \ResponseInterface ;
12
+ use Magento \Reports \Controller \Adminhtml \Report \Product ;
10
13
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
12
20
{
13
21
/**
14
22
* Authorization level of a basic admin session
15
23
*
16
24
* @see _isAllowed()
17
25
*/
18
- const ADMIN_RESOURCE = 'Magento_Reports::report_products ' ;
26
+ public const ADMIN_RESOURCE = 'Magento_Reports::report_products ' ;
19
27
20
28
/**
21
29
* Export products downloads report to CSV format
@@ -31,6 +39,6 @@ public function execute()
31
39
true
32
40
)->getCsv ();
33
41
34
- return $ this ->_fileFactory ->create ($ fileName , $ content );
42
+ return $ this ->_fileFactory ->create ($ fileName , $ content, DirectoryList:: VAR_DIR );
35
43
}
36
44
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
/**
3
- *
4
3
* Copyright © Magento, Inc. All rights reserved.
5
4
* See COPYING.txt for license details.
6
5
*/
6
+ declare (strict_types=1 );
7
+
7
8
namespace Magento \Reports \Controller \Adminhtml \Report \Product ;
8
9
10
+ use Magento \Framework \App \Filesystem \DirectoryList ;
9
11
use Magento \Framework \App \ResponseInterface ;
12
+ use Magento \Reports \Controller \Adminhtml \Report \Product ;
10
13
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
12
20
{
13
21
/**
14
22
* Authorization level of a basic admin session
15
23
*
16
24
* @see _isAllowed()
17
25
*/
18
- const ADMIN_RESOURCE = 'Magento_Reports::report_products ' ;
26
+ public const ADMIN_RESOURCE = 'Magento_Reports::report_products ' ;
19
27
20
28
/**
21
29
* Export products downloads report to XLS format
@@ -33,6 +41,6 @@ public function execute()
33
41
$ fileName
34
42
);
35
43
36
- return $ this ->_fileFactory ->create ($ fileName , $ content );
44
+ return $ this ->_fileFactory ->create ($ fileName , $ content, DirectoryList:: VAR_DIR );
37
45
}
38
46
}
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