mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-09-01 08:17:00 +02:00
Added some tests for important entity methods.
This commit is contained in:
parent
0663a00df8
commit
89258bc102
18 changed files with 480 additions and 160 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue