Exemplo n.º 1
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage An error has occurred during creating Shipment
  */
 public function testInvokeException()
 {
     $message = 'Can not save Shipment';
     $e = new \Exception($message);
     $shipmentDataObjectMock = $this->getMockBuilder('Magento\\Sales\\Service\\V1\\Data\\Shipment')->disableOriginalConstructor()->setMethods([])->getMock();
     $this->loggerMock->expects($this->once())->method('logException')->with($e);
     $this->shipmentConverterMock->expects($this->once())->method('getModel')->with($shipmentDataObjectMock)->will($this->throwException($e));
     $this->shipmentCreate->invoke($shipmentDataObjectMock);
 }
Exemplo n.º 2
0
 /**
  * test shipment create
  */
 public function testCreate()
 {
     $shipmentDataObject = $this->getMock('Magento\\Sales\\Service\\V1\\Data\\Shipment', [], [], '', false);
     $this->shipmentCreateMock->expects($this->once())->method('invoke')->with($shipmentDataObject)->will($this->returnValue(true));
     $this->assertTrue($this->shipmentWrite->create($shipmentDataObject));
 }
Exemplo n.º 3
0
 /**
  * @param \Magento\Sales\Service\V1\Data\Shipment $shipmentDataObject
  * @return bool
  * @throws \Exception
  */
 public function create(\Magento\Sales\Service\V1\Data\Shipment $shipmentDataObject)
 {
     return $this->shipmentCreate->invoke($shipmentDataObject);
 }