Skip to content

Commit

Permalink
Set correct notInRangeMessage for unit percentage discount promotion …
Browse files Browse the repository at this point in the history
…action
  • Loading branch information
diimpp committed Nov 25, 2022
1 parent 9d26672 commit c2d8d0e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Feature: Promotion validation
Then I should be notified that promotion cannot end before it start

@ui @javascript
Scenario: Trying to add a new promotion without specifying a percentage discount
Scenario: Trying to add a new promotion without specifying a order percentage discount
When I want to create a new promotion
And I specify its code as "christmas_sale"
And I name it "Christmas sale"
Expand All @@ -63,21 +63,31 @@ Feature: Promotion validation
And promotion with name "Christmas sale" should not be added

@ui @javascript
Scenario: Trying to add a new promotion with a wrong percentage discount
Scenario: Trying to add a new promotion without specifying a item percentage discount
When I want to create a new promotion
And I specify its code as "christmas_sale"
And I name it "Christmas sale"
And I add the "Item percentage discount" action configured without a percentage value
And I try to add it
Then I should be notified that this value should not be blank
And promotion with name "Christmas sale" should not be added

@ui @javascript
Scenario: Trying to add a new promotion with a wrong order percentage discount
When I want to create a new promotion
And I specify its code as "christmas_sale"
And I name it "Christmas sale"
And I add the "Order percentage discount" action configured with a percentage value of 120%
And I try to add it
Then I should be notified that the maximum value of a percentage discount is 100%
Then I should be notified that a percentage discount value must be between 0% and 100%
And promotion with name "Christmas sale" should not be added

@ui @javascript
Scenario: Trying to add a new promotion with a negative percentage discount
Scenario: Trying to add a new promotion with a wrong item percentage discount
When I want to create a new promotion
And I specify its code as "christmas_sale"
And I name it "Christmas sale"
And I add the "Order percentage discount" action configured with a percentage value of -20%
And I add the "Item percentage discount" action configured with a percentage value of 130%
And I try to add it
Then I should be notified that a percentage discount value must be at least 0%
Then I should be notified that a percentage discount value must be between 0% and 100%
And promotion with name "Christmas sale" should not be added
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,7 @@ public function iShouldBeNotifiedThatThisValueShouldNotBeBlank()
}

/**
* @Then I should be notified that a percentage discount value must be at least 0%
* @Then I should be notified that the maximum value of a percentage discount is 100%
* @Then I should be notified that a percentage discount value must be between 0% and 100%
*/
public function iShouldBeNotifiedThatPercentageDiscountShouldBeBetween(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
new Range([
'min' => 0,
'max' => 1,
'minMessage' => 'sylius.promotion_action.percentage_discount_configuration.min',
'maxMessage' => 'sylius.promotion_action.percentage_discount_configuration.max',
'notInRangeMessage' => 'sylius.promotion_action.percentage_discount_configuration.not_in_range',
'groups' => ['sylius'],
]),
],
Expand Down

0 comments on commit c2d8d0e

Please sign in to comment.