/** * @param string $payuplOrderId * @return \Orba\Payupl\Model\Sales\Order * @throws LocalizedException */ protected function loadOrderByPayuplOrderId($payuplOrderId) { $order = $this->orderHelper->loadOrderByPayuplOrderId($payuplOrderId); if (!$order) { throw new LocalizedException(new Phrase('Order not found.')); } return $order; }
public function testGetOrderByPayuplOrderIdSuccess() { $orderId = 1; $payuplOrderId = 'ABC'; $this->transactionResource->expects($this->once())->method('getOrderIdByPayuplOrderId')->with($this->equalTo($payuplOrderId))->willReturn($orderId); $order = $this->getOrderMock(); $order->expects($this->once())->method('load')->with($this->equalTo($orderId))->will($this->returnSelf()); $order->expects($this->once())->method('getId')->willReturn($orderId); $this->orderFactory->expects($this->once())->method('create')->willReturn($order); $this->assertEquals($order, $this->model->loadOrderByPayuplOrderId($payuplOrderId)); }