_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_model = $this->_objectManager->create(\Magento\Tax\Model\Calculation::class); $this->customerRepository = $this->_objectManager->create( \Magento\Customer\Api\CustomerRepositoryInterface::class ); $this->addressRepository = $this->_objectManager->create( \Magento\Customer\Api\AddressRepositoryInterface::class ); $this->groupRepository = $this->_objectManager->create(\Magento\Customer\Api\GroupRepositoryInterface::class); } public function testDefaultCustomerTaxClass() { $defaultCustomerTaxClass = 3; $this->assertEquals($defaultCustomerTaxClass, $this->_model->getDefaultCustomerTaxClass(null)); } public function testGetDefaultRateRequest() { $customerDataSet = $this->customerRepository->getById(self::FIXTURE_CUSTOMER_ID); $address = $this->addressRepository->getById(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->groupRepository->getById($customerDataSet->getGroupId())->getTaxClassId(); $this->assertEquals($customerTaxClassId, $rateRequest->getCustomerClassId()); } }