value = 10; $this->zeroValue = 0; $this->negativeValue = -1; }); it('creates a valid quantity', function (): void { // GIVEN / WHEN $quantity = new RequestedCouponQuantity( $this->value ); // THEN expect($quantity)->toBeInstanceOf(RequestedCouponQuantity::class) ->and($quantity->value)->toBe($this->value); }); it('rejects a quantity of zero', function (): void { // GIVEN / WHEN $action = fn (): RequestedCouponQuantity => new RequestedCouponQuantity( $this->zeroValue ); // THEN expect($action)->toThrow(\DomainException::class, 'Quantity should be more than 0.'); }); it('rejects a negative quantity', function (): void { // GIVEN / WHEN $action = fn (): RequestedCouponQuantity => new RequestedCouponQuantity( $this->negativeValue ); // THEN expect($action)->toThrow(\DomainException::class, 'Quantity should be more than 0.'); }); });