public function testCompareTotals() { $vatPriceSum = new VatPriceSum(); $vatPriceSum->addLineItem(new VatPriceLineItem(780, 19, true, 3))->addLineItem(new VatPriceLineItem(2500, 7, true, 10)); $this->assertEquals(27340, $vatPriceSum->getPrice()->getGrossAmount(), "", DELTA); $basePriceSum = new BasePriceSum(); $basePriceSum->addLineItem(new BasePriceLineItem(new BasePrice(1000, 220), 3))->addLineItem(new BasePriceLineItem(new BasePrice(3000, 500), 10)); $this->assertEquals($vatPriceSum->getPrice()->getGrossAmount(), $basePriceSum->getPrice()->getFinalAmount(), "", DELTA); }
public function testPriceDontIncludeVat() { $total = new Sum(); $total->addLineItem(new LineItem(285, 19, false, 1))->addLineItem(new LineItem(6000, 7, false, 1)); $this->assertEquals(6759, $total->getPrice()->getGrossAmount(), "", DELTA); // slightly off due to rounding $this->assertEquals(6285, $total->getPrice()->getNetAmount(), "", DELTA); // slightly off due to rounding $this->assertEquals(474, $total->getPrice()->getVatAmount(), "", DELTA); $this->assertEquals($total->getPrice()->getGrossAmount(), $total->getPrice()->getNetAmount() + $total->getPrice()->getVatAmount(), "", DELTA); }