Esempio n. 1
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage An error has occurred during creating Creditmemo
  */
 public function testInvokeException()
 {
     $message = 'Can not save Creditmemo';
     $e = new \Exception($message);
     $creditmemoDataObjectMock = $this->getMockBuilder('Magento\\Sales\\Service\\V1\\Data\\Creditmemo')->disableOriginalConstructor()->setMethods([])->getMock();
     $this->loggerMock->expects($this->once())->method('logException')->with($e);
     $this->creditmemoConverterMock->expects($this->once())->method('getModel')->with($creditmemoDataObjectMock)->will($this->throwException($e));
     $this->creditmemoCreate->invoke($creditmemoDataObjectMock);
 }
Esempio n. 2
0
 /**
  * @param \Magento\Sales\Service\V1\Data\Creditmemo $creditmemoDataObject
  * @throws \Exception
  * @return bool
  */
 public function create(Creditmemo $creditmemoDataObject)
 {
     return $this->creditmemoCreate->invoke($creditmemoDataObject);
 }
Esempio n. 3
0
 /**
  * test creditmemo create
  */
 public function testCreate()
 {
     $creditmemo = $this->getMock('\\Magento\\Sales\\Service\\V1\\Data\\Creditmemo', [], [], '', false);
     $this->creditmemoCreateMock->expects($this->once())->method('invoke')->with($creditmemo)->will($this->returnValue(true));
     $this->assertTrue($this->creditmemoWrite->create($creditmemo));
 }