Exemplo n.º 1
0
 public function testGetCalculatedRate()
 {
     $productTaxClassId = 1;
     $customerId = 2;
     $storeId = 3;
     $rate = 0.5;
     $storeMock = $this->getMock('\\Magento\\Store\\Model\\Store', ['getStoreId'], [], '', false);
     $this->storeManager->expects($this->once())->method('getStore')->willReturn($storeMock);
     $storeMock->expects($this->once())->method('getStoreId')->willReturn($storeId);
     $rateRequestMock = $this->getMock('\\Magento\\Framework\\DataObject', ['setProductClassId'], [], '', false);
     $this->calculationTool->expects($this->once())->method('getRateRequest')->with(null, null, null, $storeId, $customerId)->willReturn($rateRequestMock);
     $rateRequestMock->expects($this->once())->method('setProductClassId')->with($productTaxClassId)->willReturnSelf();
     $this->calculationTool->expects($this->once())->method('getRate')->with($rateRequestMock)->willReturn($rate);
     $this->assertEquals($rate, $this->taxCalculationService->getCalculatedRate($productTaxClassId, $customerId, null));
 }