예제 #1
0
 /**
  * @magentoDataFixture Magento/Sales/_files/order.php
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoDataFixture Magento/Customer/_files/customer_address.php
  */
 public function testSave()
 {
     /** @var \Magento\Sales\Model\Order $order */
     $order = Bootstrap::getObjectManager()->create('Magento\\Sales\\Model\\Order');
     /** @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface $customerAddressService */
     $customerAddressService = Bootstrap::getObjectManager()->get('Magento\\Customer\\Service\\V1\\CustomerAddressServiceInterface');
     $order->loadByIncrementId('100000001');
     $this->_model->setOrder($order);
     $this->_model->setData($customerAddressService->getAddress(1)->__toArray());
     $this->_model->setEmail('*****@*****.**');
     $this->_model->setAddressType('billing');
     $this->_model->setRegionId(1);
     $this->_model->save();
     $this->assertEquals($order->getId(), $this->_model->getParentId());
 }
예제 #2
0
 /**
  * @magentoDataFixture Magento/Sales/_files/order.php
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoDataFixture Magento/Customer/_files/customer_address.php
  */
 public function testSave()
 {
     /** @var \Magento\Sales\Model\Order $order */
     $order = Bootstrap::getObjectManager()->create('Magento\\Sales\\Model\\Order');
     $order->loadByIncrementId('100000001');
     $this->_model->setOrder($order);
     $this->_model->setEmail('*****@*****.**');
     $this->_model->setPostcode('12345');
     $this->_model->setLastname('LastName');
     $this->_model->setStreet('Street');
     $this->_model->setCity('City');
     $this->_model->setTelephone('123-45-67');
     $this->_model->setCountryId(1);
     $this->_model->setFirstname('FirstName');
     $this->_model->setAddressType('billing');
     $this->_model->setRegionId(1);
     $this->_model->save();
     $this->assertEquals($order->getId(), $this->_model->getParentId());
 }
예제 #3
0
 /**
  * Declare order shipping address
  *
  * @param \Magento\Sales\Model\Order\Address $address
  * @return $this
  */
 public function setShippingAddress(\Magento\Sales\Model\Order\Address $address)
 {
     $old = $this->getShippingAddress();
     if (!empty($old)) {
         $address->setId($old->getId());
     }
     $address->setEmail($this->getCustomerEmail());
     $this->addAddress($address->setAddressType('shipping'));
     return $this;
 }