Exemplo n.º 1
0
 public function testGetLastOrderId()
 {
     $orderIncrementId = 100001;
     $orderId = 1;
     $this->checkoutSessionMock->expects($this->once())->method('getLastOrderId')->will($this->returnValue($orderId));
     $orderMock = $this->getMock('Magento\\Sales\\Model\\Order', ['load', 'getIncrementId', '__wakeup'], [], '', false);
     $orderMock->expects($this->once())->method('load')->with($orderId)->will($this->returnSelf());
     $orderMock->expects($this->once())->method('getIncrementId')->will($this->returnValue($orderIncrementId));
     $this->orderFactoryMock->expects($this->once())->method('create')->will($this->returnValue($orderMock));
     $this->assertEquals($orderIncrementId, $this->onepage->getLastOrderId());
 }
Exemplo n.º 2
0
 /**
  * @magentoAppIsolation enabled
  */
 public function testSaveOrder()
 {
     $this->_model->saveBilling($this->_getCustomerData(), null);
     $this->_prepareQuote($this->_getQuote());
     $this->_model->saveOrder();
     /** @var $order \Magento\Sales\Model\Order */
     $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Sales\\Model\\Order');
     $order->loadByIncrementId($this->_model->getLastOrderId());
     $this->assertNotEmpty($this->_model->getQuote()->getShippingAddress()->getCustomerAddressId(), 'Quote shipping CustomerAddressId should not be empty');
     $this->assertNotEmpty($this->_model->getQuote()->getBillingAddress()->getCustomerAddressId(), 'Quote billing CustomerAddressId should not be empty');
     $this->assertNotEmpty($order->getShippingAddress()->getCustomerAddressId(), 'Order shipping CustomerAddressId should not be empty');
     $this->assertNotEmpty($order->getBillingAddress()->getCustomerAddressId(), 'Order billing CustomerAddressId should not be empty');
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getLastOrderId()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getLastOrderId');
     if (!$pluginInfo) {
         return parent::getLastOrderId();
     } else {
         return $this->___callPlugins('getLastOrderId', func_get_args(), $pluginInfo);
     }
 }