mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Adapt Behat scenarios to brand new locales logic
This commit is contained in:
parent
de8cd05930
commit
5df2bfb537
12 changed files with 68 additions and 19 deletions
|
|
@ -6,6 +6,7 @@ Feature: Adding a new channel
|
|||
|
||||
Background:
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
|
|
@ -14,6 +15,7 @@ Feature: Adding a new channel
|
|||
When I specify its code as "MOBILE"
|
||||
And I name it "Mobile channel"
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the channel "Mobile channel" should appear in the registry
|
||||
|
|
@ -27,6 +29,7 @@ Feature: Adding a new channel
|
|||
And I set its hostname as "m.avengers-gear.com"
|
||||
And I define its color as "blue"
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the channel "Mobile channel" should appear in the registry
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ Feature: Not being able to add a disabled channel when no other exist
|
|||
I want to be prevented from adding disabled channel when no other exist
|
||||
|
||||
Background:
|
||||
Given I am logged in as an administrator
|
||||
And the store has currency "Euro"
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Adding a new disabled channel should result
|
||||
|
|
@ -14,6 +15,7 @@ Feature: Not being able to add a disabled channel when no other exist
|
|||
When I specify its code as "MOBILE"
|
||||
And I name it "Mobile channel"
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I disable it
|
||||
And I add it
|
||||
Then I should be notified that at least one channel has to be defined
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ Feature: Selecting available currencies for a channel
|
|||
I want to be able to select available currencies
|
||||
|
||||
Background:
|
||||
Given the store has currency Euro
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
|
|
@ -13,7 +14,8 @@ Feature: Selecting available currencies for a channel
|
|||
Given I want to create a new channel
|
||||
When I specify its code as MOBILE
|
||||
And I name it "Mobile store"
|
||||
And I allow for paying in Euro
|
||||
And I allow for paying in "Euro"
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And paying in Euro should be possible for the "Mobile store" channel
|
||||
|
|
@ -22,7 +24,8 @@ Feature: Selecting available currencies for a channel
|
|||
Scenario: Adding currencies to an existing channel
|
||||
Given the store operates on a channel named "Web store"
|
||||
And I want to modify this channel
|
||||
When I allow for paying in Euro
|
||||
When I allow for paying in "Euro"
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I save my changes
|
||||
Then I should be notified that it has been successfully edited
|
||||
And paying in Euro should be possible for the "Web store" channel
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ Feature: Selecting default tax zone for a channel
|
|||
I want to be able to select default tax zone
|
||||
|
||||
Background:
|
||||
Given there is a zone "EU" containing all members of the European Union
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And there is a zone "EU" containing all members of the European Union
|
||||
And there is a zone "The Rest of the World" containing all other countries
|
||||
And the store has currency "Euro"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
|
|
@ -17,6 +18,7 @@ Feature: Selecting default tax zone for a channel
|
|||
And I name it "Mobile store"
|
||||
And I select the "European Union" as default tax zone
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the default tax zone for the "Mobile store" channel should be "European Union"
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ Feature: Selecting available locales for a channel
|
|||
I want to be able to select available locales
|
||||
|
||||
Background:
|
||||
Given the store has locale "Norwegian (Norway)"
|
||||
And the store has currency "Euro"
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
|
|
@ -14,17 +14,18 @@ Feature: Selecting available locales for a channel
|
|||
Given I want to create a new channel
|
||||
When I specify its code as "MOBILE"
|
||||
And I name it "Mobile channel"
|
||||
And I make it available in "Norwegian (Norway)"
|
||||
And I make it available in "English (United States)"
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the channel "Mobile channel" should be available in "Norwegian (Norway)"
|
||||
And the channel "Mobile channel" should be available in "English (United States)"
|
||||
|
||||
@ui
|
||||
Scenario: Adding locales to an existing channel
|
||||
Given the store operates on a channel named "Web Channel"
|
||||
And I want to modify this channel
|
||||
When I make it available in "Norwegian (Norway)"
|
||||
When I make it available in "English (United States)"
|
||||
And I save my changes
|
||||
Then I should be notified that it has been successfully edited
|
||||
And the channel "Web channel" should be available in "Norwegian (Norway)"
|
||||
And the channel "Web channel" should be available in "English (United States)"
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ Feature: Selecting available payment methods for a channel
|
|||
I want to be able to select available payment methods
|
||||
|
||||
Background:
|
||||
Given the store has a payment method "Offline" with a code "OFF"
|
||||
And the store has currency "Euro"
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And the store has a payment method "Offline" with a code "OFF"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
|
|
@ -16,6 +17,7 @@ Feature: Selecting available payment methods for a channel
|
|||
And I name it "Mobile store"
|
||||
And I select the "Offline" payment method
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the "Offline" payment method should be available for the "Mobile store" channel
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ Feature: Selecting available shipping methods for a channel
|
|||
I want to be able to select available shipping methods
|
||||
|
||||
Background:
|
||||
Given there is a zone "EU" containing all members of the European Union
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And there is a zone "EU" containing all members of the European Union
|
||||
And the store allows shipping with "UPS Carrier" identified by "UPS_CARRIER"
|
||||
And the store has currency "Euro"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
|
|
@ -17,6 +18,7 @@ Feature: Selecting available shipping methods for a channel
|
|||
And I name it "Mobile store"
|
||||
And I select the "UPS Carrier" shipping method
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the "UPS Carrier" shipping method should be available for the "Mobile store" channel
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ Feature: Selecting tax calculation strategy for a channel
|
|||
I want to be able to select tax calculation strategy
|
||||
|
||||
Background:
|
||||
Given I am logged in as an administrator
|
||||
And the store has currency "Euro"
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Adding a new channel with implicitly selected tax calculation strategy
|
||||
|
|
@ -14,6 +15,7 @@ Feature: Selecting tax calculation strategy for a channel
|
|||
When I specify its code as "MOBILE"
|
||||
And I name it "Mobile store"
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the tax calculation strategy for the "Mobile store" channel should be "Order items based"
|
||||
|
|
@ -25,6 +27,7 @@ Feature: Selecting tax calculation strategy for a channel
|
|||
And I select the "Order item units based" as tax calculation strategy
|
||||
And I name it "Mobile store"
|
||||
And I choose "Euro" as a default currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the tax calculation strategy for the "Mobile store" channel should be "Order item units based"
|
||||
|
|
|
|||
|
|
@ -109,6 +109,15 @@ final class ManagingChannelsContext implements Context
|
|||
$this->createPage->chooseDefaultCurrency($currency);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I choose :locale as a default locale
|
||||
* @When I do not choose default locale
|
||||
*/
|
||||
public function iChooseAsADefaultLocale($locale = null)
|
||||
{
|
||||
$this->createPage->chooseDefaultLocale($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I add it
|
||||
* @When I try to add it
|
||||
|
|
|
|||
|
|
@ -83,6 +83,16 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
$this->getDocument()->selectFieldOption('Default tax zone', $taxZone);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function chooseDefaultLocale($locale)
|
||||
{
|
||||
if (null !== $locale) {
|
||||
$this->getElement('default_locale')->selectOption($locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -121,6 +131,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
'name' => '#sylius_channel_name',
|
||||
'default_currency' => '#sylius_channel_defaultCurrency',
|
||||
'currencies' => '#sylius_channel_currencies',
|
||||
'default_locale' => '#sylius_channel_defaultLocale',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,11 @@ interface CreatePageInterface extends BaseCreatePageInterface
|
|||
*/
|
||||
public function chooseDefaultTaxZone($taxZone);
|
||||
|
||||
/**
|
||||
* @param string $locale
|
||||
*/
|
||||
public function chooseDefaultLocale($locale);
|
||||
|
||||
/**
|
||||
* @param string $currency
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ Sylius\Component\Core\Model\Channel:
|
|||
hostname: "localhost"
|
||||
description: "Lorem ipsum"
|
||||
defaultCurrency: "@currency"
|
||||
defaultLocale: "@locale"
|
||||
color: "black"
|
||||
enabled: true
|
||||
taxCalculationStrategy: "order_items_based"
|
||||
|
|
@ -14,3 +15,8 @@ Sylius\Component\Currency\Model\Currency:
|
|||
code: EUR
|
||||
exchangeRate: 1
|
||||
enabled: true
|
||||
|
||||
Sylius\Component\Locale\Model\Locale:
|
||||
locale:
|
||||
code: en_US
|
||||
enabled: true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue