Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Promotion] Improve coupon generation validation message #10880

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,15 @@ public function couponShouldStillExistInTheRegistry(PromotionCouponInterface $co
}

/**
* @Then /^I should be notified that generating (\d+) coupons with code length equal to (\d+) is not possible$/
* @Then I should be notified that generating :amount coupons with code length equal to :codeLength is not possible
*/
public function iShouldBeNotifiedThatGeneratingCouponsWithCodeLengthIsNotPossible($amount, $codeLength)
public function iShouldBeNotifiedThatGeneratingCouponsWithCodeLengthIsNotPossible(int $amount, int $codeLength): void
{
$message = sprintf('Invalid coupons code length or coupons amount. It is not possible to generate %d unique coupons with code length equals %d. Possible generate amount is 8.', $amount, $codeLength);

Assert::true($this->generatePage->checkGenerationValidation($message));
Assert::true($this->generatePage->checkGenerationValidation(sprintf(
'Invalid coupons code length or coupons amount. It is not possible to generate %d unique coupons with code length %d. The possible amount to generate is 8.',
$amount,
$codeLength
)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ sylius:
min: Coupon code must be at least {{ limit }} characters long.
max: Coupon code must not be longer than {{ limit }} characters.
not_blank: Please enter coupon code length.
possible_generation_amount: Invalid coupons code length or coupons amount. It is not possible to generate %expectedAmount% unique coupons with code length equals %codeLength%. Possible generate amount is %possibleAmount%.
possible_generation_amount: Invalid coupons code length or coupons amount. It is not possible to generate %expectedAmount% unique coupons with code length %codeLength%. The possible amount to generate is %possibleAmount%.
usage_limit:
min: Usage limit of generated coupons must be at least {{ limit }}.