private function getProductTaxRate() { /** @var $taxCalculator \Magento\Tax\Model\Calculation */ $taxCalculator = $this->calculation; $request = $taxCalculator->getRateRequest($this->quote->getShippingAddress(), $this->quote->getBillingAddress(), $this->quote->getCustomerTaxClassId(), $this->quote->getStore()); $request->setProductClassId($this->getProduct()->getTaxClassId()); return $taxCalculator->getRate($request); }
public function testGetCustomerTaxClassId() { $groupId = 1; $taxClassId = 1; $groupMock = $this->getMockForAbstractClass('Magento\\Customer\\Api\\Data\\GroupInterface', [], '', false); $groupMock->expects($this->once())->method('getTaxClassId')->willReturn($taxClassId); $this->groupRepositoryMock->expects($this->once())->method('getById')->with($groupId)->will($this->returnValue($groupMock)); $this->quote->setData('customer_group_id', $groupId); $result = $this->quote->getCustomerTaxClassId(); $this->assertEquals($taxClassId, $result); }