/** * Ensure that order is created correctly via createOrder(). * * @param \Magento\Sales\Model\Order $order * @param string $shippingMethod */ protected function _verifyCreatedOrder($order, $shippingMethod) { /** Selectively check order data */ $orderData = $order->getData(); $this->assertNotEmpty($orderData['increment_id'], 'Order increment ID is empty.'); $this->assertEquals($this->_model->getQuote()->getId(), $orderData['quote_id'], 'Quote ID is invalid.'); $this->assertEquals($this->_model->getQuote()->getCustomer()->getEmail(), $orderData['customer_email'], 'Customer email is invalid.'); $this->assertEquals($this->_model->getQuote()->getCustomer()->getFirstname(), $orderData['customer_firstname'], 'Customer first name is invalid.'); $this->assertEquals($shippingMethod, $orderData['shipping_method'], 'Shipping method is invalid.'); }
public function testExecuteSuccess() { $params = ['success' => 1, 'controller_action_name' => 'action', 'x_invoice_num' => 1]; $this->requestMock->expects($this->once())->method('getParams')->willReturn($params); $this->helperMock->expects($this->once())->method('getSuccessOrderUrl')->willReturn('redirect_parent_url'); $this->directpostSessionMock->expects($this->once())->method('unsetData')->with('quote_id'); $this->orderMock->expects($this->once())->method('getId')->willReturn(null); $this->sessionQuoteMock->expects($this->atLeastOnce())->method('getOrder')->willReturn($this->orderMock); $this->adminOrderCreateMock->expects($this->atLeastOnce())->method('getSession')->willReturn($this->sessionQuoteMock); $this->coreRegistryMock->expects($this->once())->method('register')->with(Iframe::REGISTRY_KEY); $this->assertInstanceOf('\\Magento\\Framework\\View\\Result\\Layout', $this->controller->execute()); }
public function testUpdateQuoteItemsWithConfiguredOption() { $qty = 100000000; $items = [1 => ['qty' => 10, 'configured' => true, 'action' => false]]; $itemMock = $this->getMock('Magento\\Quote\\Model\\Quote\\Item', [], [], '', false); $itemMock->expects($this->once())->method('getQty')->will($this->returnValue($qty)); $quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', [], [], '', false); $quoteMock->expects($this->once())->method('updateItem')->will($this->returnValue($itemMock)); $this->sessionQuoteMock->expects($this->any())->method('getQuote')->will($this->returnValue($quoteMock)); $expectedInfo = $items[1]; $expectedInfo['qty'] = $qty; $this->itemUpdater->expects($this->once())->method('update')->with($this->equalTo($itemMock), $this->equalTo($expectedInfo)); $this->adminOrderCreate->setRecollect(false); $this->adminOrderCreate->updateQuoteItems($items); }