Example #1
0
 public function testGetDefaultRateRequest()
 {
     $customerDataSet = $this->_customerAccountService->getCustomer(self::FIXTURE_CUSTOMER_ID);
     $address = $this->_addressService->getAddress(self::FIXTURE_ADDRESS_ID);
     $rateRequest = $this->_model->getRateRequest(null, null, null, null, $customerDataSet->getId());
     $this->assertNotNull($rateRequest);
     $this->assertEquals($address->getCountryId(), $rateRequest->getCountryId());
     $this->assertEquals($address->getRegion()->getRegionId(), $rateRequest->getRegionId());
     $this->assertEquals($address->getPostcode(), $rateRequest->getPostcode());
     $customerTaxClassId = $this->_groupService->getGroup($customerDataSet->getGroupId())->getTaxClassId();
     $this->assertEquals($customerTaxClassId, $rateRequest->getCustomerClassId());
 }
Example #2
0
 /**
  * Update Customer name in Quote
  */
 protected function _updateQuoteCustomerName()
 {
     /** @var $emptyAddress \Magento\Sales\Model\Quote\Address */
     $emptyAddress = $this->_quoteAddressFactory->create();
     $emptyAddress->setFirstname(null);
     $emptyAddress->setLastname(null);
     $this->_block->getQuote()->setBillingAddress($emptyAddress);
     $customerData = $this->_customerService->getCustomer(self::FIXTURE_CUSTOMER_ID);
     $customerData = $this->_customerBuilder->populate($customerData)->setFirstname(self::SAMPLE_FIRST_NAME)->setLastname(self::SAMPLE_LAST_NAME)->create();
     $this->_block->getQuote()->setCustomerData($customerData);
     $this->_block->getQuote()->save();
     $this->assertEquals(self::SAMPLE_FIRST_NAME, $this->_block->getFirstname());
     $this->assertEquals(self::SAMPLE_LAST_NAME, $this->_block->getLastname());
 }