/** * @return void */ public function testExecute() { $content = ['export']; $fileName = 'products_ordered.xml'; $this->abstractBlockMock->expects($this->once())->method('getExcelFile')->with($fileName)->willReturn($content); $this->layoutMock->expects($this->once())->method('getChildBlock')->with('adminhtml.report.grid', 'grid.export')->willReturn($this->abstractBlockMock); $this->fileFactoryMock->expects($this->once())->method('create')->with($fileName, $content, \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR); $this->exportSoldExcel->execute(); }