mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[API][Tax rate] Implement deleting_tax_rate feature
This commit is contained in:
parent
f84fce7dc9
commit
c8fe3b325f
3 changed files with 37 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ Feature: Deleting a tax rate
|
|||
And the store has "United States Sales Tax" tax rate of 20% for "Sports gear" within the "US" zone
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Deleted tax rate should disappear from the registry
|
||||
When I delete tax rate "United States Sales Tax"
|
||||
Then I should be notified that it has been successfully deleted
|
||||
|
|
|
|||
|
|
@ -150,4 +150,36 @@ class ManagingTaxRateContext implements Context
|
|||
sprintf('Tax rate does is not included in price')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I delete tax rate :taxRate
|
||||
*/
|
||||
public function iDeleteTaxRate(TaxRateInterface $taxRate): void
|
||||
{
|
||||
$this->client->delete((string) $taxRate->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that it has been successfully deleted
|
||||
*/
|
||||
public function iShouldBeNotifiedThatItHasBeenSuccessfullyDeleted(): void
|
||||
{
|
||||
Assert::true(
|
||||
$this->responseChecker->isDeletionSuccessful($this->client->getLastResponse()),
|
||||
'Tax rate could not be deleted'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this tax rate) should no longer exist in the registry$/
|
||||
*/
|
||||
public function thisTaxRateShouldNoLongerExistInTheRegistry(TaxRateInterface $taxRate): void
|
||||
{
|
||||
$name = $taxRate->getName();
|
||||
|
||||
Assert::false(
|
||||
$this->responseChecker->hasItemWithValue($this->client->index(), 'name', $name),
|
||||
sprintf('Tax rate with name %s exists', $name)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@
|
|||
<itemOperation name="admin_get">
|
||||
<attribute name="method">GET</attribute>
|
||||
</itemOperation>
|
||||
|
||||
<itemOperation name="admin_delete">
|
||||
<attribute name="method">DELETE</attribute>
|
||||
</itemOperation>
|
||||
</itemOperations>
|
||||
</resource>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue