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 = StockId::generate(); $warningThresholdQty = 100; // WHEN $campaignCoupon = new CampaignCoupon($code, $qty, $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 = StockId::generate(); $printRules = new PrintRules(maxPerCustomer: 3); $warningThresholdQty = -100; // GIVEN / THEN expect(fn (): CampaignCoupon => new CampaignCoupon($code, $qty, $warningThresholdQty, $printRules))->toThrow(\DomainException::class); }); it('rejects invalid campaign coupon whitout print rules', function (): void { // GIVEN $code = new ProcessingCode('PC1'); $qty = StockId::generate(); $warningThresholdQty = -100; // GIVEN / THEN expect(fn (): CampaignCoupon => new CampaignCoupon($code, $qty, $warningThresholdQty))->toThrow(\DomainException::class); }); });