/**
  * This is a procedural test, testing that the method `ebayenterprise_order/ordershipped::process`
  * when invoke will call the expected methods and pass in the expected parameter values.
  */
 public function testOrderShippedEvent()
 {
     $id = 7;
     $canShip = true;
     $order = $this->getModelMock('sales/order', ['loadByIncrementId', 'canShip']);
     $order->setId($id);
     $order->expects($this->once())->method('loadByIncrementId')->with($this->identicalTo(static::PAYLOAD_CUSTOMER_ORDER_ID))->will($this->returnSelf());
     $order->expects($this->any())->method('canShip')->will($this->returnValue($canShip));
     $this->replaceByMock('model', 'sales/order', $order);
     $this->_shipmentHelper->expects($this->once())->method('process')->with($this->identicalTo($order), $this->identicalTo($this->_payload))->will($this->returnSelf());
     $this->_ordershipped->process();
 }
 /**
  * Processing order shipped event by loading the order using the customer order id
  * from the payload, if we have a valid order in Magento we proceed to attempt
  * to add shipment data to the order.
  * @return self
  */
 public function process()
 {
     $order = $this->_getOrder();
     if ($order) {
         $this->_shipmentEventHelper->process($order, $this->_payload);
     }
     return $this;
 }
 /**
  * Testing 'EbayEnterprise_Order_Helper_Event_Shipment::process' method
  * taking a sales/order instance and an array of shipment data, then expects
  * the save method on the 'core/resource_transaction' model to be called once in order
  * not to save the shipment data to the database.
  * @param array $itemData
  * @param bool $isException Flag for the mock save method to throw or not throw exception
  * @dataProvider dataProvider
  */
 public function testProcess(array $itemData, $isException)
 {
     $this->_payload->deserialize(file_get_contents(__DIR__ . '/ShipmentTest/fixtures/Process-OrderShipped.xml'));
     $order = Mage::getModel('sales/order');
     $this->_addItemsToOrder($order, $itemData, 'sku', 'sku', 'item_id');
     $exceptionMsg = 'Simulating throwing exception when saving shipment.';
     $transaction = $this->getModelMock('core/resource_transaction', ['save']);
     $transaction->expects($this->once())->method('save')->will($isException ? $this->throwException(Mage::exception('Mage_Core', $exceptionMsg)) : $this->returnSelf());
     $this->replaceByMock('model', 'core/resource_transaction', $transaction);
     $this->assertSame($this->_shipmentHelper, $this->_shipmentHelper->process($order, $this->_payload));
 }