mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
bug #13731 [Taxation] Add validation of negative tax rate (coldic3)
This PR was merged into the 1.10 branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | master <!-- see the comment below --> | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | | License | MIT Commits -------f3c7821496[Taxation][Behat][UI] Add negative tax rate scenariof4e9a0b1b3[Taxation] Add validation of negative tax rateb754ada149[Taxation] Change validation message23ddba32b9[Taxation] Remove redundant translation43dc7631ac[Taxation] Fix translation keys orderd76ccba31e[Taxation] Fix Missing type hint and return type523a4eaa9a[Taxation][Behat][UI] Fix typo
This commit is contained in:
commit
0ae681c968
4 changed files with 23 additions and 1 deletions
|
|
@ -81,3 +81,12 @@ Feature: Tax rate validation
|
|||
When I remove its zone
|
||||
And I try to save my changes
|
||||
Then I should be notified that zone has to be selected
|
||||
|
||||
@ui
|
||||
Scenario: Trying to add a new tax rate with negative amount
|
||||
When I want to create a new tax rate
|
||||
And I name it "Food and Beverage Tax Rates"
|
||||
And I specify its amount as -20%
|
||||
And I try to add it
|
||||
Then I should be notified that amount is invalid
|
||||
And tax rate with name "Food and Beverage Tax Rates" should not be added
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ final class ManagingTaxRateContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @When I specify its amount as :amount%
|
||||
* @When /^I specify its amount as ([^"]+)%$/
|
||||
* @When I do not specify its amount
|
||||
* @When I remove its amount
|
||||
*/
|
||||
|
|
@ -238,6 +238,14 @@ final class ManagingTaxRateContext implements Context
|
|||
$this->assertFieldValidationMessage($element, sprintf('Please enter tax rate %s.', $element));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that :element is invalid
|
||||
*/
|
||||
public function iShouldBeNotifiedThatIsInvalid(string $element): void
|
||||
{
|
||||
$this->assertFieldValidationMessage($element, sprintf('The tax rate %s is invalid.', $element));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then tax rate with :element :name should not be added
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@
|
|||
<option name="message">sylius.tax_rate.amount.not_blank</option>
|
||||
<option name="groups">sylius</option>
|
||||
</constraint>
|
||||
<constraint name="Positive">
|
||||
<option name="message">sylius.tax_rate.amount.invalid</option>
|
||||
<option name="groups">sylius</option>
|
||||
</constraint>
|
||||
</property>
|
||||
<property name="calculator">
|
||||
<constraint name="NotBlank">
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ sylius:
|
|||
name:
|
||||
not_blank: Please enter tax rate name.
|
||||
amount:
|
||||
invalid: The tax rate amount is invalid.
|
||||
not_blank: Please enter tax rate amount.
|
||||
calculator:
|
||||
not_blank: Please select tax calculator.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue