/** * @covers \Magento\Paypal\Model\Hostedpro\Request::setOrder */ public function testSetOrder() { $expectation = ['invoice' => '#000001', 'address_override' => 'true', 'currency_code' => 'USD', 'buyer_email' => '*****@*****.**']; $order = $this->getMockBuilder('Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock(); $order->expects(static::once())->method('getIncrementId')->willReturn($expectation['invoice']); $order->expects(static::once())->method('getBaseCurrencyCode')->willReturn($expectation['currency_code']); $order->expects(static::once())->method('getCustomerEmail')->willReturn($expectation['buyer_email']); $this->_model->setOrder($order); static::assertEquals($expectation, $this->_model->getData()); }
/** * @dataProvider addressesDataProvider */ public function testSetOrderAddresses($billing, $shipping, $billingState, $state) { $payment = $this->getMock('Magento\\Sales\\Model\\Order\\Payment', ['__wakeup'], [], '', false); $order = $this->getMock('Magento\\Sales\\Model\\Order', ['getPayment', '__wakeup', 'getBillingAddress', 'getShippingAddress'], [], '', false); $order->expects($this->any())->method('getPayment')->will($this->returnValue($payment)); $order->expects($this->any())->method('getBillingAddress')->will($this->returnValue($billing)); $order->expects($this->any())->method('getShippingAddress')->will($this->returnValue($shipping)); $this->_model->setOrder($order); $this->assertEquals($billingState, $this->_model->getData('billing_state')); $this->assertEquals($state, $this->_model->getData('state')); }
/** * @covers \Magento\Paypal\Model\Hostedpro\Request::setOrder() * @magentoDataFixture Magento/Paypal/_files/order_hostedpro.php */ public function testSetOrder() { $incrementId = '100000001'; /** @var \Magento\Sales\Model\Order $order */ $order = $this->objectManager->create(Order::class); $order->loadByIncrementId($incrementId); $this->model->setOrder($order); $addressData = (require __DIR__ . '/../../_files/address_data.php'); static::assertEquals($incrementId, $this->model->getInvoice()); $this->assertAddress($addressData, 'billing'); $this->assertAddress($addressData); }