mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Cover handling different currencies on multiple channels via API scenarios
This commit is contained in:
parent
f750f33357
commit
dc4cd8a71c
2 changed files with 36 additions and 4 deletions
|
|
@ -5,19 +5,19 @@ Feature: Handling different currencies on multiple channels
|
|||
I want to browse channels with a valid currency only
|
||||
|
||||
Background:
|
||||
Given the store operates on a channel named "Web" in "EUR" currency
|
||||
Given the store operates on a channel named "Web" in "EUR" currency and with hostname "web.localhost.example"
|
||||
And that channel allows to shop using "EUR", "USD" and "GBP" currencies
|
||||
And the store operates on another channel named "Mobile" in "USD" currency
|
||||
And the store operates on another channel named "Mobile" in "USD" currency and with hostname "m.localhost.example"
|
||||
And that channel allows to shop using "USD" and "GBP" currencies
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Showing currencies only from the current channel
|
||||
When I browse the "Mobile" channel
|
||||
Then I should shop using the "USD" currency
|
||||
And I should be able to shop using the "GBP" currency
|
||||
And I should not be able to shop using the "EUR" currency
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Browsing channels using their default currencies
|
||||
When I browse the "Web" channel
|
||||
And I start browsing the "Mobile" channel
|
||||
|
|
|
|||
|
|
@ -57,4 +57,36 @@ final class ChannelContext implements Context
|
|||
sprintf('%s/shop/currencies/%s', $this->apiUrlPrefix, $currencyCode),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be able to shop using the :currencyCode currency
|
||||
*/
|
||||
public function iShouldBeAbleToShopUsingTheCurrency(string $currencyCode): void
|
||||
{
|
||||
$this->client->index(Resources::CURRENCIES);
|
||||
|
||||
Assert::true(
|
||||
$this->responseChecker->hasItemWithValue(
|
||||
$this->client->getLastResponse(),
|
||||
'code',
|
||||
$currencyCode,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should not be able to shop using the :currencyCode currency
|
||||
*/
|
||||
public function iShouldNotBeAbleToShopUsingTheCurrency(string $currencyCode): void
|
||||
{
|
||||
$this->client->index(Resources::CURRENCIES);
|
||||
|
||||
Assert::false(
|
||||
$this->responseChecker->hasItemWithValue(
|
||||
$this->client->getLastResponse(),
|
||||
'code',
|
||||
$currencyCode,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue