Added some tests for important entity methods.

This commit is contained in:
Jan Böhmer 2019-11-09 00:31:42 +01:00
parent 0663a00df8
commit 89258bc102
18 changed files with 480 additions and 160 deletions

View file

@ -138,9 +138,9 @@ class Orderdetail extends DBElement
/**
* Get the part.
*
* @return Part the part of this orderdetails
* @return Part|null the part of this orderdetails
*/
public function getPart(): Part
public function getPart(): ?Part
{
return $this->part;
}
@ -235,12 +235,13 @@ class Orderdetail extends DBElement
}
/**
* Get the pricedetail for a specific quantity.
* Find the pricedetail that is correct for the desired amount (the one with the greatest discount value with a
* minimum order amount of the wished quantity)
* @param float $quantity this is the quantity to choose the correct pricedetails
*
* @return Pricedetail|null: the price as a bcmath string. Null if there are no orderdetails for the given quantity
*/
public function getPrice(float $quantity = 1) : ?Pricedetail
public function findPriceForQty(float $quantity = 1) : ?Pricedetail
{
if ($quantity <= 0) {
return null;