This commit is contained in:
Thomas Peterson 2018-04-17 11:10:13 +02:00
parent 0b25641c35
commit ae27792eac
2 changed files with 16 additions and 1 deletions

View File

@ -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();

View File

@ -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());
}
}