This commit is contained in:
buchmann 2026-07-27 11:15:05 +02:00
parent 1a0b67f361
commit 1632424fa5

View file

@ -208,6 +208,32 @@ final class ProjectBuildHelperTest extends WebTestCase
$this->assertTrue(BigDecimal::of('6.00')->isEqualTo($result));
}
public function testCalculateTotalBuildPriceWithBuildPartFromSubproject(): void
{
$project = new Project();
$entry = new ProjectBOMEntry();
$entry->setPart($this->makePartWithPrice(1.50));
$entry->setQuantity(4);
$project->addBomEntry($entry);
$subproject = new Project();
$subproject->setParent($project);
$subentry = new ProjectBOMEntry();
$subentry->setPart($this->makePartWithPrice(3.5));
$subentry->setQuantity(2);
$entry2 = new ProjectBOMEntry();
$entry2->setPart(new Part());
$entry2->setQuantity(2);
$subproject->setBuildPart($entry2);
$project->addBomEntry($entry2);
// 4 × 1.50 + 2 x (2 x 3.5) = 20.00 for 1 build
$result = $this->service->calculateTotalBuildPrice($project, 1);
$this->assertNotNull($result);
$this->assertTrue(BigDecimal::of('20.00')->isEqualTo($result));
}
public function testCalculateUnitBuildPriceEqualsTotal(): void
{
$project = new Project();