Fixes
This commit is contained in:
parent
dceccfbd59
commit
0b25641c35
@ -37,6 +37,9 @@ class Engine
|
|||||||
/** @var float */
|
/** @var float */
|
||||||
protected $price = 0;
|
protected $price = 0;
|
||||||
|
|
||||||
|
/** @var float */
|
||||||
|
protected $tax = 0;
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $dirty = true;
|
protected $dirty = true;
|
||||||
|
|
||||||
@ -224,6 +227,17 @@ class Engine
|
|||||||
return round($this->price,2);
|
return round($this->price,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getTaxPrice()
|
||||||
|
{
|
||||||
|
if($this->dirty) {
|
||||||
|
$this->calc();
|
||||||
|
}
|
||||||
|
return round($this->price+($this->price/100*$this->tax),2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $price
|
* @param mixed $price
|
||||||
*/
|
*/
|
||||||
@ -253,4 +267,20 @@ class Engine
|
|||||||
$this->variables[$var] = $value;
|
$this->variables[$var] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getTax()
|
||||||
|
{
|
||||||
|
return $this->tax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param float $tax
|
||||||
|
*/
|
||||||
|
public function setTax($tax)
|
||||||
|
{
|
||||||
|
$this->tax = $tax;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -33,6 +33,8 @@ class PriceMinTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->engine->calc();
|
$this->engine->calc();
|
||||||
|
|
||||||
$this->assertEquals(2500, $this->engine->getPrice());
|
$this->assertEquals(2500, $this->engine->getPrice());
|
||||||
|
$this->engine->setTax(19);
|
||||||
|
$this->assertEquals(2975, $this->engine->getTaxPrice());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIfCalcReturnsGrenzeWithFormular()
|
public function testIfCalcReturnsGrenzeWithFormular()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user