value = 10; $this->zeroValue = 0; $this->negativeValue = -1; }); it('creates a valid stock amount', function (): void { // GIVEN / WHEN $amount = new StockAmount( $this->value ); // THEN expect($amount)->toBeInstanceOf(StockAmount::class) ->and($amount->value)->toBe($this->value); }); it('accepts a zero value', function (): void { // GIVEN / WHEN $amount = new StockAmount( $this->zeroValue ); // THEN expect($amount->value)->toBe($this->zeroValue); }); it('rejects a negative value', function (): void { // GIVEN / WHEN $action = fn (): StockAmount => new StockAmount( $this->negativeValue ); // THEN expect($action)->toThrow(\DomainException::class, 'Stock Amount should be positive.'); }); });