mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
deleting zone
This commit is contained in:
parent
3ddbcbf90b
commit
e2c514f4be
4 changed files with 47 additions and 3 deletions
|
|
@ -11,13 +11,13 @@ Feature: Deleting a zone
|
||||||
And the store has "Sales Tax" tax rate of 20% for "Sports gear" within the "SA" zone
|
And the store has "Sales Tax" tax rate of 20% for "Sports gear" within the "SA" zone
|
||||||
And I am logged in as an administrator
|
And I am logged in as an administrator
|
||||||
|
|
||||||
@ui
|
@ui @api
|
||||||
Scenario: Deleted zone should disappear from the registry
|
Scenario: Deleted zone should disappear from the registry
|
||||||
When I delete zone named "North America"
|
When I delete zone named "North America"
|
||||||
Then I should be notified that it has been successfully deleted
|
Then I should be notified that it has been successfully deleted
|
||||||
And the zone named "North America" should no longer exist in the registry
|
And the zone named "North America" should no longer exist in the registry
|
||||||
|
|
||||||
@ui
|
@ui @api
|
||||||
Scenario: Deleting zone with associated tax rates should not be possible
|
Scenario: Deleting zone with associated tax rates should not be possible
|
||||||
When I delete zone named "South America"
|
When I delete zone named "South America"
|
||||||
Then I should be notified that this zone cannot be deleted
|
Then I should be notified that this zone cannot be deleted
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,14 @@ final class ManagingZonesContext implements Context
|
||||||
$this->client->index();
|
$this->client->index();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I delete zone named :zoneName
|
||||||
|
*/
|
||||||
|
public function iDeleteZoneNamed(ZoneInterface $zoneName): void
|
||||||
|
{
|
||||||
|
$this->client->delete($zoneName->getCode());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then I should be notified that it has been successfully created
|
* @Then I should be notified that it has been successfully created
|
||||||
*/
|
*/
|
||||||
|
|
@ -184,12 +192,46 @@ final class ManagingZonesContext implements Context
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then I should see the zone named :name in the list
|
* @Then I should see the zone named :name in the list
|
||||||
|
* @Then I should still see the zone named :name in the list
|
||||||
*/
|
*/
|
||||||
public function iShouldSeeTheZoneNamedInTheList(string $name): void
|
public function iShouldSeeTheZoneNamedInTheList(string $name): void
|
||||||
{
|
{
|
||||||
Assert::true(
|
Assert::true(
|
||||||
$this->responseChecker->hasItemWithValue($this->client->getLastResponse(), 'name', $name),
|
$this->responseChecker->hasItemWithValue($this->client->index(), 'name', $name),
|
||||||
sprintf('There is no zone with name "%s"', $name)
|
sprintf('There is no zone with name "%s"', $name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then I should be notified that it has been successfully deleted
|
||||||
|
*/
|
||||||
|
public function iShouldBeNotifiedThatItHasBeenSuccessfullyDeleted(): void
|
||||||
|
{
|
||||||
|
Assert::true($this->responseChecker->isDeletionSuccessful(
|
||||||
|
$this->client->getLastResponse()),
|
||||||
|
'Zone could not be deleted'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then the zone named :name should no longer exist in the registry
|
||||||
|
*/
|
||||||
|
public function theZoneNamedShouldNoLongerExistInTheRegistry(string $name): void
|
||||||
|
{
|
||||||
|
Assert::false(
|
||||||
|
$this->responseChecker->hasItemWithValue($this->client->index(), 'name', $name),
|
||||||
|
sprintf('Zone with name %s exist', $name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then I should be notified that this zone cannot be deleted
|
||||||
|
*/
|
||||||
|
public function iShouldBeNotifiedThatThisZoneCannotBeDeleted(): void
|
||||||
|
{
|
||||||
|
Assert::false(
|
||||||
|
$this->responseChecker->isDeletionSuccessful($this->client->getLastResponse()),
|
||||||
|
'Zone can be deleted, but it should not'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ default:
|
||||||
|
|
||||||
- sylius.behat.context.setup.admin_api_security
|
- sylius.behat.context.setup.admin_api_security
|
||||||
- sylius.behat.context.setup.geographical
|
- sylius.behat.context.setup.geographical
|
||||||
|
- sylius.behat.context.setup.taxation
|
||||||
- sylius.behat.context.setup.zone
|
- sylius.behat.context.setup.zone
|
||||||
|
|
||||||
- sylius.behat.context.api.admin.managing_zones
|
- sylius.behat.context.api.admin.managing_zones
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
<attribute name="groups">zone:update</attribute>
|
<attribute name="groups">zone:update</attribute>
|
||||||
</attribute>
|
</attribute>
|
||||||
</itemOperation>
|
</itemOperation>
|
||||||
|
<itemOperation name="delete" />
|
||||||
</itemOperations>
|
</itemOperations>
|
||||||
|
|
||||||
<property name="id" identifier="false" writable="false" />
|
<property name="id" identifier="false" writable="false" />
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue