Added test for stocktake method on PartLotWithdrawAddHelper

This commit is contained in:
Jan Böhmer 2026-02-10 23:19:57 +01:00
parent d8fdaa9529
commit 3c87fe0932

View file

@ -154,4 +154,19 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
$this->assertEqualsWithDelta(5.0, $this->partLot2->getAmount(), PHP_FLOAT_EPSILON);
$this->assertEqualsWithDelta(2.0, $this->partLot3->getAmount(), PHP_FLOAT_EPSILON);
}
public function testStocktake(): void
{
//Stocktake lot 1 to 20
$this->service->stocktake($this->partLot1, 20, "Test");
$this->assertEqualsWithDelta(20.0, $this->partLot1->getAmount(), PHP_FLOAT_EPSILON);
$this->assertNotNull($this->partLot1->getLastStocktakeAt()); //Stocktake date should be set
//Stocktake lot 2 to 5
$this->partLot2->setInstockUnknown(true);
$this->service->stocktake($this->partLot2, 0, "Test");
$this->assertEqualsWithDelta(0.0, $this->partLot2->getAmount(), PHP_FLOAT_EPSILON);
$this->assertFalse($this->partLot2->isInstockUnknown()); //Instock unknown should be cleared
}
}