public function test_execute()
 {
     /** === Setup Mocks === */
     // $order = $observer->getData(self::DATA_ORDER);
     $mOrder = $this->_mock(\Magento\Sales\Api\Data\OrderInterface::class);
     $this->mObserver->shouldReceive('getData')->once()->with('order')->andReturn($mOrder);
     // $this->_subRegister->splitQty($order);
     $this->mSubRegister->shouldReceive('splitQty')->once();
     /** === Call and asserts  === */
     $this->obj->execute($this->mObserver);
 }
 public function test_execute()
 {
     /** === Test Data === */
     $OBSERVER = $this->_mock(\Magento\Framework\Event\Observer::class);
     /** === Setup Mocks === */
     // $order = $observer->getData(self::DATA_ORDER);
     $mOrder = $this->_mock(\Magento\Sales\Model\Order::class);
     $OBSERVER->shouldReceive('getData')->once()->with(CheckoutSubmitAllAfter::DATA_ORDER)->andReturn($mOrder);
     // $this->_subRegister->savePv($order);
     $this->mSubRegister->shouldReceive('savePv')->once();
     // $this->_subRegister->accountPv($order);
     $this->mSubRegister->shouldReceive('accountPv')->once();
     /** === Call and asserts  === */
     $this->obj->execute($OBSERVER);
 }
 public function test_execute_exception()
 {
     /** === Test Data === */
     $STATE = \Magento\Sales\Model\Order::STATE_PROCESSING;
     $mObserver = $this->_mock(\Magento\Framework\Event\Observer::class);
     /** === Setup Mocks === */
     // $order = $observer->getData(self::DATA_ORDER);
     $mOrder = $this->_mock(\Magento\Sales\Api\Data\OrderInterface::class);
     $mObserver->shouldReceive('getData')->once()->with(CheckoutSubmitAllAfter::DATA_ORDER)->andReturn($mOrder);
     // $state = $order->getState();
     $mOrder->shouldReceive('getState')->once()->andReturn($STATE);
     // $this->_callReplicate->orderSave($req);
     $this->mCallReplicate->shouldReceive('orderSave')->once()->andThrow(new \Exception());
     /** === Call and asserts  === */
     $this->obj->execute($mObserver);
 }
 public function test_execute_exception()
 {
     /** === Test Data === */
     $STATE = \Magento\Sales\Model\Order\Invoice::STATE_PAID;
     $mObserver = $this->_mock(\Magento\Framework\Event\Observer::class);
     /** === Setup Mocks === */
     // $invoice = $observer->getData(self::DATA_INVOICE);
     $mInvoice = $this->_mock(\Magento\Sales\Model\Order\Invoice::class);
     $mObserver->shouldReceive('getData')->once()->with(SalesOrderInvoicePay::DATA_INVOICE)->andReturn($mInvoice);
     // $state = $invoice->getState();
     $mInvoice->shouldReceive('getState')->once()->andReturn($STATE);
     // $order = $invoice->getOrder();
     $mOrder = $this->_mock(\Magento\Sales\Api\Data\OrderInterface::class);
     $mInvoice->shouldReceive('getOrder')->once()->andReturn($mOrder);
     // $this->_callReplicate->orderSave($req);
     $this->mCallReplicate->shouldReceive('orderSave')->once()->andThrow(new \Exception());
     /** === Call and asserts  === */
     $this->obj->execute($mObserver);
 }