public function testSavePaymentInformationAndPlaceOrderIfBillingAddressNotExist() { $cartId = 100; $orderId = 200; $paymentMock = $this->getMock('\\Magento\\Quote\\Api\\Data\\PaymentInterface'); $this->billingAddressManagementMock->expects($this->never())->method('assign'); $this->paymentMethodManagementMock->expects($this->once())->method('set')->with($cartId, $paymentMock); $this->cartManagementMock->expects($this->once())->method('placeOrder')->with($cartId)->willReturn($orderId); $this->assertEquals($orderId, $this->model->savePaymentInformationAndPlaceOrder($cartId, $paymentMock)); }
/** * {@inheritdoc} */ public function savePaymentInformationAndPlaceOrder($cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, \Magento\Quote\Api\Data\AddressInterface $billingAddress = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'savePaymentInformationAndPlaceOrder'); if (!$pluginInfo) { return parent::savePaymentInformationAndPlaceOrder($cartId, $paymentMethod, $billingAddress); } else { return $this->___callPlugins('savePaymentInformationAndPlaceOrder', func_get_args(), $pluginInfo); } }