Beispiel #1
0
 /**
  * @expectedException \Magento\Framework\Exception\CouldNotSaveException
  */
 public function testCanNotRemove()
 {
     $this->optionMock->expects($this->once())->method('load')->with(10);
     $this->optionMock->expects($this->any())->method('getId')->will($this->returnValue(10));
     $this->productMock->expects($this->once())->method('getOptions')->will($this->returnValue([10 => $this->optionMock]));
     $this->optionMock->expects($this->once())->method('delete');
     $this->productMock->expects($this->once())->method('setHasOptions')->with(false);
     $this->productMock->expects($this->once())->method('save')->will($this->throwException(new \Exception()));
     $this->writeService->remove(self::PRODUCT_SKU, 10);
 }