code)->toBe($code) ->and($campaignCoupon->qty)->toBe($qty) ->and($campaignCoupon->printRules)->toBe($printRules) ->and($campaignCoupon->warningThresholdQty)->toBe($warningThresholdQty); }); it('creates a valid campaign coupon whitout print rules', function (): void { // GIVEN $code = new ProcessingCode('PC1'); $qty = new StockId(); $warningThresholdQty = 100; // WHEN $campaignCoupon = new CampaignCoupon(code: $code, qty: $qty, warningThresholdQty: $warningThresholdQty); // THEN expect($campaignCoupon->code)->toBe($code) ->and($campaignCoupon->qty)->toBe($qty) ->and($campaignCoupon->warningThresholdQty)->toBe($warningThresholdQty); }); it('rejects invalid campaign coupon', function (): void { // GIVEN $code = new ProcessingCode('PC1'); $qty = new StockId(); $printRules = new PrintRules(maxPerCustomer: 3); $warningThresholdQty = -100; // GIVEN / THEN expect(fn (): CampaignCoupon => new CampaignCoupon(code: $code, qty: $qty, printRules: $printRules, warningThresholdQty: $warningThresholdQty))->toThrow(\DomainException::class); }); it('rejects invalid campaign coupon whitout print rules', function (): void { // GIVEN $code = new ProcessingCode('PC1'); $qty = new StockId(); $warningThresholdQty = -100; // GIVEN / THEN expect(fn (): CampaignCoupon => new CampaignCoupon(code: $code, qty: $qty, warningThresholdQty: $warningThresholdQty))->toThrow(\DomainException::class); }); });