/** * @expectedException \Magento\Framework\Exception\StateException * @expectedExceptionMessage Unable to remove product product-42 */ public function testDeleteException() { $this->productMock->expects($this->once())->method('getSku')->willReturn('product-42'); $this->resourceModelMock->expects($this->once())->method('delete')->with($this->productMock) ->willThrowException(new \Exception()); $this->model->delete($this->productMock); }
/** * {@inheritdoc} */ public function delete(\Magento\Catalog\Api\Data\ProductInterface $product) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'delete'); if (!$pluginInfo) { return parent::delete($product); } else { return $this->___callPlugins('delete', func_get_args(), $pluginInfo); } }