Exemple #1
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage An error has occurred during creating Invoice
  */
 public function testInvokeException()
 {
     $message = 'Can not save Invoice';
     $e = new \Exception($message);
     $invoiceDataObjectMock = $this->getMockBuilder('Magento\\Sales\\Service\\V1\\Data\\Invoice')->disableOriginalConstructor()->setMethods([])->getMock();
     $this->loggerMock->expects($this->once())->method('logException')->with($e);
     $this->invoiceConverterMock->expects($this->once())->method('getModel')->with($invoiceDataObjectMock)->will($this->throwException($e));
     $this->invoiceCreate->invoke($invoiceDataObjectMock);
 }
Exemple #2
0
 /**
  * @param \Magento\Sales\Service\V1\Data\Invoice $invoiceDataObject
  * @return bool
  * @throws \Exception
  */
 public function create(\Magento\Sales\Service\V1\Data\Invoice $invoiceDataObject)
 {
     return $this->invoiceCreate->invoke($invoiceDataObject);
 }
Exemple #3
0
 /**
  * test invoice create
  */
 public function testCreate()
 {
     $invoiceDataObject = $this->getMock('Magento\\Sales\\Service\\V1\\Data\\Invoice', [], [], '', false);
     $this->invoiceCreateMock->expects($this->once())->method('invoke')->with($invoiceDataObject)->will($this->returnValue(true));
     $this->assertTrue($this->invoiceWrite->create($invoiceDataObject));
 }