toBeInstanceOf(StockAdjustment::class) ->and($adjustment->quantity)->toBe($quantity) ->and($adjustment->reason)->toBe($reason) ->and($adjustment->actorId)->toBe($actorId) ->and($adjustment->createdAt)->toBeNull(); }); it('creates a stock adjustment with an explicit createdAt date', function () use ($quantity, $reason): void { // GIVEN $actorId = ActorId::generate(); $createdAt = new \DateTimeImmutable('2026-06-15 12:00:00', new \DateTimeZone('UTC')); // WHEN $adjustment = new StockAdjustment( $quantity, $reason, $actorId, $createdAt, ); // THEN expect($adjustment->createdAt)->toBe($createdAt); }); it('rejects a quantity of zero or negative', function (int $value) use ($reason): void { // GIVEN $actorId = ActorId::generate(); // WHEN $action = fn (): StockAdjustment => new StockAdjustment( $value, $reason, $actorId, ); // THEN expect($action)->toThrow(\DomainException::class, 'Stock Amount should be more than 0.'); })->with([ $zeroQuantity, $negativeQuantity, ]); });