コード例 #1
0
 public function testCalculateWithTaxNotInPrice()
 {
     $mockItem = $this->getMockItem();
     $mockItem->expects($this->once())->method('getIsTaxIncluded')->will($this->returnValue(false));
     $this->mockConfig->expects($this->once())->method('applyTaxAfterDiscount')->will($this->returnValue(true));
     $this->mockCalculationTool->expects($this->once())->method('getRate')->with($this->addressRateRequest)->will($this->returnValue(self::RATE));
     $this->mockCalculationTool->expects($this->once())->method('getAppliedRates')->withAnyParameters()->will($this->returnValue([['id' => 0, 'percent' => 0, 'rates' => []]]));
     $this->assertSame($this->taxDetailsItem, $this->model->calculate($mockItem, self::QUANTITY));
     $this->assertEquals(self::CODE, $this->taxDetailsItem->getCode());
     $this->assertEquals(self::TYPE, $this->taxDetailsItem->getType());
     $this->assertEquals(0.0, $this->taxDetailsItem->getRowTax());
 }