40 $this->dateMock = $this->getMockBuilder(\
Magento\Framework\Stdlib\DateTime\Filter\Date::class)
41 ->disableOriginalConstructor()
44 $this->helperMock = $this->getMockBuilder(\
Magento\Backend\Helper\Data::class)
45 ->disableOriginalConstructor()
48 $this->objectManagerMock = $this->getMockBuilder(\
Magento\Framework\ObjectManagerInterface::class)
49 ->disableOriginalConstructor()
51 $this->objectManagerMock
52 ->expects($this->any())
54 ->willReturn($this->helperMock);
56 $this->contextMock->expects($this->any())->method(
'getObjectManager')->willReturn($this->objectManagerMock);
58 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
60 \
Magento\Reports\Controller\Adminhtml\Report\Product\ExportViewedCsv::class,
62 'context' => $this->contextMock,
63 'fileFactory' => $this->fileFactoryMock,
64 'dateFilter' => $this->dateMock,
77 $this->abstractBlockMock
78 ->expects($this->once())
79 ->method(
'getCsvFile')
83 ->expects($this->once())
84 ->method(
'createBlock')
85 ->with(\
Magento\Reports\Block\Adminhtml\Product\
Viewed\Grid::class)
86 ->willReturn($this->abstractBlockMock);
88 $this->fileFactoryMock
89 ->expects($this->once())
93 $this->exportViewedCsv->execute();