22 private $fileFactoryMock;
27 private $objectManagerHelper;
32 private $resultFactoryMock;
36 $this->objectManagerHelper =
new ObjectManagerHelper($this);
37 $this->fileFactoryMock = $this->createMock(\
Magento\Framework\
App\
Response\Http\FileFactory::class);
38 $this->resultFactoryMock = $this->createMock(\
Magento\Framework\Controller\ResultFactory::class);
40 $this->controller = $this->objectManagerHelper->getObject(
41 \
Magento\Search\Controller\Adminhtml\Term\ExportSearchCsv::class,
43 'fileFactory' => $this->fileFactoryMock,
44 'resultFactory' => $this->resultFactoryMock
51 $resultLayoutMock = $this->createMock(\
Magento\Framework\View\Result\Layout::class);
52 $layoutMock = $this->createMock(\
Magento\Framework\View\LayoutInterface::class);
53 $contentMock = $this->createPartialMock(\
Magento\Framework\View\Element\AbstractBlock::class, [
'getCsvFile']);
54 $this->resultFactoryMock
55 ->expects($this->once())
58 $resultLayoutMock->expects($this->once())->method(
'getLayout')->willReturn($layoutMock);
59 $layoutMock->expects($this->once())->method(
'getChildBlock')->willReturn($contentMock);
60 $contentMock->expects($this->once())->method(
'getCsvFile')->willReturn(
'csvFile');
61 $this->fileFactoryMock
62 ->expects($this->once())
65 $this->controller->execute();