/** * @dataProvider dataForUploaderDir */ public function testSetUploaderDirFalse($newSku, $bunch, $allowImport) { $this->connectionMock->expects($this->any())->method('fetchAll')->with($this->select)->willReturnOnConsecutiveCalls([['attribute_set_name' => '1', 'attribute_id' => '1'], ['attribute_set_name' => '2', 'attribute_id' => '2']]); $this->downloadableModelMock = $this->objectManagerHelper->getObject('\\Magento\\DownloadableImportExport\\Model\\Import\\Product\\Type\\Downloadable', ['attrSetColFac' => $this->attrSetColFacMock, 'prodAttrColFac' => $this->prodAttrColFacMock, 'resource' => $this->resourceMock, 'params' => $this->paramsArray, 'uploaderHelper' => $this->uploaderHelper, 'downloadableHelper' => $this->downloadableHelper]); $this->entityModelMock->expects($this->once())->method('getNewSku')->will($this->returnValue($newSku)); $this->entityModelMock->expects($this->at(1))->method('getNextBunch')->will($this->returnValue($bunch)); $this->entityModelMock->expects($this->at(2))->method('getNextBunch')->will($this->returnValue(null)); $this->entityModelMock->expects($this->any())->method('isRowAllowedToImport')->willReturn($allowImport); $exception = new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Error')); $this->setExpectedException('\\Magento\\Framework\\Exception\\LocalizedException'); $this->setExpectedException('\\Exception'); $this->uploaderMock->expects($this->any())->method('move')->will($this->throwException($exception)); $this->downloadableModelMock->saveData(); }