diff --git a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php index 697d3983..b033f07e 100644 --- a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php +++ b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php @@ -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 + + } }