/** * @return void */ public function testExecute() { $content = ['export']; $fileName = 'products_downloads.xml'; $this->abstractBlockMock->expects($this->once())->method('setSaveParametersInSession')->willReturnSelf(); $this->abstractBlockMock->expects($this->once())->method('getExcel')->with($fileName)->willReturn($content); $this->layoutMock->expects($this->once())->method('createBlock')->with('Magento\\Reports\\Block\\Adminhtml\\Product\\Downloads\\Grid')->willReturn($this->abstractBlockMock); $this->fileFactoryMock->expects($this->once())->method('create')->with($fileName, $content); $this->exportDownloadsExcel->execute(); }