Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-reports
Test
Unit
Controller
Adminhtml
Report
Product
ExportLowstockExcelTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product
;
8
9
use
Magento\Reports\Controller\Adminhtml\Report\Product\ExportLowstockExcel
;
10
11
class
ExportLowstockExcelTest
extends
\Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
12
{
16
protected
$exportLowstockExcel
;
17
21
protected
$dateMock
;
22
26
protected
function
setUp
()
27
{
28
parent::setUp();
29
30
$this->dateMock = $this->getMockBuilder(\
Magento
\Framework\Stdlib\DateTime\Filter\Date::class)
31
->disableOriginalConstructor()
32
->getMock();
33
34
$objectManager
= new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
35
$this->exportLowstockExcel =
$objectManager
->getObject(
36
\
Magento
\Reports\Controller\Adminhtml\Report\Product\ExportLowstockExcel::class,
37
[
38
'context'
=> $this->contextMock,
39
'fileFactory'
=> $this->fileFactoryMock,
40
'dateFilter'
=> $this->dateMock,
41
]
42
);
43
}
44
48
public
function
testExecute
()
49
{
50
$content
= [
'export'
];
51
52
$this->abstractBlockMock
53
->expects($this->once())
54
->method(
'getExcelFile'
)
55
->willReturn(
$content
);
56
57
$this->layoutMock
58
->expects($this->once())
59
->method(
'getChildBlock'
)
60
->with(
'adminhtml.block.report.product.lowstock.grid'
,
'grid.export'
)
61
->willReturn($this->abstractBlockMock);
62
63
$this->fileFactoryMock
64
->expects($this->once())
65
->method(
'create'
)
66
->with(
'products_lowstock.xml'
,
$content
, \
Magento
\Framework\
App
\Filesystem\DirectoryList::VAR_DIR);
67
68
$this->exportLowstockExcel->execute();
69
}
70
}
Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product\ExportLowstockExcelTest\$exportLowstockExcel
$exportLowstockExcel
Definition:
ExportLowstockExcelTest.php:16
Magento\Framework\App
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
Definition:
AbstractControllerTest.php:12
Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product\ExportLowstockExcelTest
Definition:
ExportLowstockExcelTest.php:11
Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product\ExportLowstockExcelTest\$dateMock
$dateMock
Definition:
ExportLowstockExcelTest.php:21
Magento\Reports\Controller\Adminhtml\Report\Product\ExportLowstockExcel
Definition:
ExportLowstockExcel.php:12
Magento
$content
$content
Definition:
downloadable_product_with_files_and_sample_url.php:93
Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product\ExportLowstockExcelTest\setUp
setUp()
Definition:
ExportLowstockExcelTest.php:26
Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product\ExportLowstockExcelTest\testExecute
testExecute()
Definition:
ExportLowstockExcelTest.php:48
Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product
Definition:
DownloadsTest.php:7