Skip to content

Commit

Permalink
Merge pull request #15912 from matthieu-rolland/fix-behat-test
Browse files Browse the repository at this point in the history
Fix missing currency in behat test
  • Loading branch information
matks committed Oct 11, 2019
2 parents 3074bbb + 7f4aadb commit cbb7c64
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"@php -d date.timezone=UTC ./vendor/bin/phpunit -c tests-legacy/old-controllers.xml"
],
"integration-behaviour-tests": [
"@php -d date.timezone=UTC ./vendor/bin/behat -c tests/Integration/Behaviour/behat.yml"
"@php -d date.timezone=UTC ./vendor/bin/behat -c tests/Integration/Behaviour/behat.yml --no-snippets --strict"
],
"create-release": "@php tools/build/CreateRelease.php",
"git-hook-install": "@php .github/contrib/install.php",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Cart;
use Configuration;
use Context;
use Currency;
use Country;
use Exception;
use PrestaShop\PrestaShop\Core\Domain\Cart\Command\CreateEmptyCustomerCartCommand;
Expand All @@ -42,6 +43,21 @@

class CartFeatureContext extends AbstractDomainFeatureContext
{
/**
* @given the current currency is :currencyIsoCode
*/
public function addCurrencyToContext($currencyIsoCode)
{
$currency = new Currency();
$currency->name = $currencyIsoCode;
$currency->precision = 2;
$currency->iso_code = $currencyIsoCode;
$currency->active = 1;
$currency->conversion_rate = 1;

Context::getContext()->currency = $currency;
}

/**
* @When I create an empty cart :cartReference for customer :customerReference
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ Feature: Cart calculation with currencies
Given currency "currency2" is the current one
Given there is a product in the catalog named "product1" with a price of 19.812 and 1000 items in stock
When I add 3 items of product "product1" in my cart
Then my cart total should be 83 tax included
Then my cart total using previous calculation method should be 83 tax included
Then my cart total should be 83.0 tax included
Then my cart total using previous calculation method should be 83.0 tax included

Scenario: 3 products in cart, several quantities
Given I have an empty default cart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Feature: Add Order from Back Office

Scenario: Add order from Back Office with free shipping
Given I am logged in as "test@prestashop.com" employee
Given The current currency is "EUR"
And there is customer "customer1" with email "pub@prestashop.com"
And customer "customer1" has address in "US" country
And the module "dummy_payment" is installed
Expand Down

0 comments on commit cbb7c64

Please sign in to comment.