Exemplo n.º 1
0
 public function testOrder()
 {
     $this->_nvp->expects($this->any())->method('setProcessableErrors')->will($this->returnSelf());
     $this->_nvp->expects($this->any())->method('setAmount')->will($this->returnSelf());
     $this->_nvp->expects($this->any())->method('setCurrencyCode')->will($this->returnSelf());
     $this->_nvp->expects($this->any())->method('setTransactionId')->will($this->returnSelf());
     $this->_nvp->expects($this->any())->method('callDoAuthorization')->will($this->returnSelf());
     $this->_pro->expects($this->any())->method('getApi')->will($this->returnValue($this->_nvp));
     $this->_checkoutSession->expects($this->once())->method('getPaypalTransactionData')->will($this->returnValue([]));
     $this->_checkoutSession->expects($this->once())->method('setPaypalTransactionData')->with([]);
     $currency = $this->getMock('Magento\\Directory\\Model\\Currency', ['__wakeup', 'formatTxt'], [], '', false);
     $paymentModel = $this->getMock('Magento\\Sales\\Model\\Order\\Payment', ['__wakeup', 'getBaseCurrency', 'getOrder', 'getIsTransactionPending', 'addStatusHistoryComment'], [], '', false);
     $paymentModel->expects($this->any())->method('getOrder')->will($this->returnSelf());
     $paymentModel->expects($this->any())->method('getBaseCurrency')->will($this->returnValue($currency));
     $paymentModel->expects($this->any())->method('getIsTransactionPending')->will($this->returnSelf());
     $this->_model = $this->_helper->getObject('Magento\\Paypal\\Model\\Express', ['proFactory' => $this->_pro, 'checkoutSession' => $this->_checkoutSession]);
     $this->_model->order($paymentModel, 12.3);
     $this->assertEquals('payment_review', $paymentModel->getState());
 }