diff --git a/src/Engine.php b/src/Engine.php index 132e3c7..940dae7 100644 --- a/src/Engine.php +++ b/src/Engine.php @@ -231,6 +231,17 @@ class Engine * @return mixed */ public function getTaxPrice() + { + if($this->dirty) { + $this->calc(); + } + return round(($this->price/100*$this->tax),2); + } + + /** + * @return mixed + */ + public function getCompletePrice() { if($this->dirty) { $this->calc(); diff --git a/tests/Calc/PriceMinTest.php b/tests/Calc/PriceMinTest.php index 6996cce..8955db8 100644 --- a/tests/Calc/PriceMinTest.php +++ b/tests/Calc/PriceMinTest.php @@ -34,7 +34,8 @@ class PriceMinTest extends \PHPUnit_Framework_TestCase $this->assertEquals(2500, $this->engine->getPrice()); $this->engine->setTax(19); - $this->assertEquals(2975, $this->engine->getTaxPrice()); + $this->assertEquals(475, $this->engine->getTaxPrice()); + $this->assertEquals(2975, $this->engine->getCompletePrice()); } public function testIfCalcReturnsGrenzeWithFormular() @@ -50,6 +51,9 @@ class PriceMinTest extends \PHPUnit_Framework_TestCase $this->engine->calc(); $this->assertEquals(2721.40, $this->engine->getPrice()); + $this->engine->setTax(19); + $this->assertEquals(517.07, $this->engine->getTaxPrice()); + $this->assertEquals(3238.47, $this->engine->getCompletePrice()); } } \ No newline at end of file