mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-08-03 23:21:44 +00:00
fix test again
This commit is contained in:
parent
8842b9c853
commit
b1473ca448
2 changed files with 4 additions and 4 deletions
|
|
@ -244,7 +244,7 @@ final readonly class ProjectBuildHelper
|
|||
private function getBomEntryUnitPrice(ProjectBOMEntry $entry, int $number_of_builds, ?Currency $currency): ?BigDecimal
|
||||
{
|
||||
if ($entry->getPart() && $entry->getPart()->getBuiltProject() instanceof Project){
|
||||
return $this->calculateTotalBuildPrice($entry->getPart()->getBuiltProject(), intval($entry->getQuantity()), $entry->getPriceCurrency());
|
||||
return $this->calculateTotalBuildPrice($entry->getPart()->getBuiltProject(), 1, $entry->getPriceCurrency());
|
||||
}
|
||||
|
||||
if ($entry->getPart() instanceof Part) {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ final class ProjectBuildHelperTest extends WebTestCase
|
|||
$subproject = new Project();
|
||||
$subentry = new ProjectBOMEntry();
|
||||
$subentry->setPart($this->makePartWithPrice(3.5));
|
||||
$subentry->setQuantity(2);
|
||||
$subentry->setQuantity(3);
|
||||
$subproject->addBomEntry($subentry);
|
||||
|
||||
$part = new Part();
|
||||
|
|
@ -229,10 +229,10 @@ final class ProjectBuildHelperTest extends WebTestCase
|
|||
$part->setBuiltProject($subproject);
|
||||
$project->addBomEntry($entry2);
|
||||
|
||||
// 4 × 1.50 + 2 x (2 x 3.5) = 20.00 for 1 build
|
||||
// 4 × 1.50 + 2 x (3 x 3.5) = 27.00 for 1 build
|
||||
$result = $this->service->calculateTotalBuildPrice($project, 1);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertTrue(BigDecimal::of('20.00')->isEqualTo($result));
|
||||
$this->assertTrue(BigDecimal::of('27.00')->isEqualTo($result));
|
||||
}
|
||||
|
||||
public function testCalculateUnitBuildPriceEqualsTotal(): void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue