Merge pull request #7650 from pamil/pull-request/7609

Make Payum routes locale-independent
This commit is contained in:
Paweł Jędrzejewski 2017-03-02 19:50:28 +01:00 committed by GitHub
commit 35242ac749
7 changed files with 38 additions and 9 deletions

View file

@ -389,6 +389,13 @@ From now on it won't compute every possible permutation of fallback locales from
translator: { fallbacks: ["%locale%", "en"] }
```
* Payum routes were made independent of the current locale. Add the following code to `app/config/routing.yml`:
```yaml
sylius_shop_payum:
resource: "@SyliusShopBundle/Resources/config/routing/payum.yml"
```
### Security
* Firewalls configuration was changed to provide better CSRF protection and turn on remember me feature, update your `app/config/security.yml`:

View file

@ -15,6 +15,9 @@ sylius_shop:
requirements:
_locale: ^[a-z]{2}(?:_[A-Z]{2})?$
sylius_shop_payum:
resource: "@SyliusShopBundle/Resources/config/routing/payum.yml"
sylius_shop_default_locale:
path: /
methods: [GET]

View file

@ -6,6 +6,7 @@ Feature: Paying offline during checkout as guest
Background:
Given the store operates on a single channel in "United States"
And that channel allows to shop using "English (United States)" and "French (France)" locales
And the store has a product "PHP T-Shirt" priced at "$19.99"
And the store ships everywhere for free
And the store allows paying offline
@ -19,3 +20,10 @@ Feature: Paying offline during checkout as guest
And I choose "Offline" payment method
And I confirm my order
Then I should see the thank you page
@ui
Scenario: Successfully placing an order using custom locale
Given I have product "PHP T-Shirt" in the cart
When I proceed through checkout process in the "French (France)" locale
And I confirm my order
Then I should see the thank you page in "French (France)"

View file

@ -33,6 +33,14 @@ final class CheckoutThankYouContext implements Context
Assert::true($this->thankYouPage->hasThankYouMessage());
}
/**
* @Then I should see the thank you page in :localeCode
*/
public function iShouldSeeTheThankYouPageInLocale($localeCode)
{
Assert::false($this->thankYouPage->isOpen(['_locale' => $localeCode]));
}
/**
* @Then I should not see the thank you page
*/

View file

@ -246,9 +246,12 @@ class CompletePage extends SymfonyPage implements CompletePageInterface
return false !== strpos($this->getElement('currency')->getText(), $currencyCode);
}
/**
* {@inheritdoc}
*/
public function confirmOrder()
{
$this->getDocument()->pressButton('Place order');
$this->getElement('confirm_button')->press();
}
public function changeAddress()
@ -320,13 +323,14 @@ class CompletePage extends SymfonyPage implements CompletePageInterface
{
return array_merge(parent::getDefinedElements(), [
'addressing_step_label' => '.steps a:contains("Address")',
'base_order_total' => '#base-total',
'billing_address' => '#sylius-billing-address',
'confirm_button' => 'form button',
'currency' => '#sylius-order-currency-code',
'extra_notes' =>'#sylius_checkout_complete_notes',
'items_table' => '#sylius-order',
'locale' => '#sylius-order-locale-name',
'order_total' => 'td:contains("Total")',
'base_order_total' => '#base-total',
'payment_method' => '#sylius-payment-method',
'payment_step_label' => '.steps a:contains("Payment")',
'product_row' => 'tbody tr:contains("%name%")',

View file

@ -10,25 +10,27 @@ default:
- sylius.behat.context.transform.address
- sylius.behat.context.transform.customer
- sylius.behat.context.transform.lexical
- sylius.behat.context.transform.locale
- sylius.behat.context.transform.order
- sylius.behat.context.transform.payment
- sylius.behat.context.transform.product
- sylius.behat.context.transform.shared_storage
- sylius.behat.context.transform.shipping_method
- sylius.behat.context.transform.tax_category
- sylius.behat.context.transform.tax_rate
- sylius.behat.context.transform.zone
- sylius.behat.context.setup.channel
- sylius.behat.context.setup.geographical
- sylius.behat.context.setup.currency
- sylius.behat.context.setup.geographical
- sylius.behat.context.setup.locale
- sylius.behat.context.setup.order
- sylius.behat.context.setup.payment
- sylius.behat.context.setup.product
- sylius.behat.context.setup.shipping
- sylius.behat.context.setup.shop_security
- sylius.behat.context.setup.taxation
- sylius.behat.context.setup.user
- sylius.behat.context.setup.product
- sylius.behat.context.setup.shipping
- sylius.behat.context.transform.shipping_method
- sylius.behat.context.ui.paypal
- sylius.behat.context.ui.shop.cart

View file

@ -48,9 +48,6 @@ sylius_shop_account:
resource: "@SyliusShopBundle/Resources/config/routing/account.yml"
prefix: /account
sylius_shop_payum:
resource: "@SyliusShopBundle/Resources/config/routing/payum.yml"
sylius_shop_switch_currency:
path: /switch-currency/{code}
methods: [GET]