mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[Promotion] Fixes in scenarios to fit changed logic
This commit is contained in:
parent
e6b75f69ee
commit
3d102dbed0
7 changed files with 33 additions and 32 deletions
|
|
@ -5,7 +5,7 @@ UPGRADE
|
|||
|
||||
### Promotion and PromotionBundle
|
||||
|
||||
* Changed "item_count" promotion type into "cart_quantity". It now checks cart quantity rather than different items number.
|
||||
* Changed "item_count" promotion type into "cart_quantity". It now checks cart quantity instead different items number.
|
||||
|
||||
### Resource and SyliusResourceBundle
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ Feature: Checkout promotions with multiple rules and actions
|
|||
Scenario: Promotion is not applied when one of the cart does not
|
||||
fulfills one of the rule
|
||||
Given I am on the store homepage
|
||||
When I add product "Sarge" to cart, with quantity "7"
|
||||
When I add product "Sarge" to cart, with quantity "2"
|
||||
Then I should be on the cart summary page
|
||||
And "Promotion total" should not appear on the page
|
||||
And "Grand total: €175.00" should appear on the page
|
||||
And "Grand total: €50.00" should appear on the page
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ Feature: Checkout coupon promotions
|
|||
| type | configuration |
|
||||
| Fixed discount | Amount: 5 |
|
||||
And promotion "New Year campaign" has following rules defined:
|
||||
| type | configuration |
|
||||
| Cart quantity| Count: 2 |
|
||||
| type | configuration |
|
||||
| Cart quantity | Count: 2 |
|
||||
And promotion "New Year campaign" has following actions defined:
|
||||
| type | configuration |
|
||||
| Fixed discount | Amount: 10 |
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ Feature: Checkout fixed discount promotions
|
|||
And all promotions are assigned to the default channel
|
||||
And promotion "3 items" has following rules defined:
|
||||
| type | configuration |
|
||||
| Cart quantity | Count: 3,Equal: true |
|
||||
| Cart quantity | Count: 4,Equal: true |
|
||||
And promotion "3 items" has following actions defined:
|
||||
| type | configuration |
|
||||
| Fixed discount | Amount: 15 |
|
||||
|
|
@ -77,50 +77,50 @@ Feature: Checkout fixed discount promotions
|
|||
Scenario: Fixed discount promotion is not applied when the cart
|
||||
has not the required amount
|
||||
Given I am on the store homepage
|
||||
When I add product "Sarge" to cart, with quantity "8"
|
||||
When I add product "Sarge" to cart, with quantity "3"
|
||||
Then I should be on the cart summary page
|
||||
And "Promotion total" should not appear on the page
|
||||
And "Grand total: €200.00" should appear on the page
|
||||
And "Grand total: €75.00" should appear on the page
|
||||
|
||||
Scenario: Cart quantity promotion is applied when the cart has the
|
||||
number of items required
|
||||
Given I am on the store homepage
|
||||
And I added product "Sarge" to cart, with quantity "3"
|
||||
And I added product "Sarge" to cart, with quantity "1"
|
||||
And I added product "Etch" to cart, with quantity "1"
|
||||
When I add product "Lenny" to cart, with quantity "2"
|
||||
Then I should be on the cart summary page
|
||||
And "Promotion total: -€15.00" should appear on the page
|
||||
And "Grand total: €110.00" should appear on the page
|
||||
And "Grand total: €60.00" should appear on the page
|
||||
|
||||
Scenario: Cart quantity promotion is not applied when the cart has
|
||||
not the number of items required
|
||||
not required quantity
|
||||
Given I am on the store homepage
|
||||
When I add product "Etch" to cart, with quantity "8"
|
||||
When I add product "Etch" to cart, with quantity "3"
|
||||
Then I should be on the cart summary page
|
||||
And "Promotion total" should not appear on the page
|
||||
And "Grand total: €160.00" should appear on the page
|
||||
And "Grand total: €60.00" should appear on the page
|
||||
|
||||
Scenario: Shipping country promotion is applied when shipping country match
|
||||
Given I am on the store homepage
|
||||
When I add product "Lenny" to cart, with quantity "5"
|
||||
When I add product "Lenny" to cart, with quantity "3"
|
||||
And I go to the checkout start page
|
||||
And I fill in the shipping address to Germany
|
||||
And I press "Continue"
|
||||
And I go to the cart summary page
|
||||
Then "Promotion total: -€40.00" should appear on the page
|
||||
And "Grand total: €35.00" should appear on the page
|
||||
And "Grand total: €5.00" should appear on the page
|
||||
|
||||
Scenario: Shipping country promotion is not applied when shipping country does not match
|
||||
Given I am on the store homepage
|
||||
When I add product "Lenny" to cart, with quantity "5"
|
||||
When I add product "Lenny" to cart, with quantity "3"
|
||||
And I go to the checkout start page
|
||||
And I fill in the shipping address to Poland
|
||||
And I press "Continue"
|
||||
And I go to the cart summary page
|
||||
And "Promotion total" should not appear on the page
|
||||
And "Grand total: €75.00" should appear on the page
|
||||
And "Grand total: €45.00" should appear on the page
|
||||
|
||||
Scenario: Ubuntu T-Shirts promotion is applied when the cart containes Ubuntu T-Shirts
|
||||
Scenario: Ubuntu T-Shirts promotion is applied when the cart contains Ubuntu T-Shirts
|
||||
Given I am on the store homepage
|
||||
When I add product "Ubu" to cart, with quantity "1"
|
||||
Then I should be on the cart summary page
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ Feature: Checkout percentage discount promotions
|
|||
Given store has default configuration
|
||||
And the following promotions exist:
|
||||
| code | name | description |
|
||||
| PR1 | 3 items | 25% Discount for orders with at least 3 items |
|
||||
| PR1 | 5 items | 25% Discount for orders with at least 5 items |
|
||||
| PR2 | 300 EUR | 10% Discount for orders over 300 EUR |
|
||||
And promotion "3 items" has following rules defined:
|
||||
And promotion "5 items" has following rules defined:
|
||||
| type | configuration |
|
||||
| cart quantity | Count: 3,Equal: true |
|
||||
And promotion "3 items" has following actions defined:
|
||||
| cart quantity | Count: 5,Equal: true |
|
||||
And promotion "5 items" has following actions defined:
|
||||
| type | configuration |
|
||||
| percentage discount | percentage: 25 |
|
||||
And promotion "300 EUR" has following rules defined:
|
||||
|
|
@ -43,18 +43,18 @@ Feature: Checkout percentage discount promotions
|
|||
Given I am on the store homepage
|
||||
When I add product "Etch" to cart, with quantity "4"
|
||||
Then I should be on the cart summary page
|
||||
# Valid scenario that is not passing, should follow '3 items' promotion
|
||||
# Valid scenario that is not passing, should follow '5 items' promotion
|
||||
# And "Promotion total: -€20.00" should appear on the page
|
||||
# And "Grand total: €60.00" should appear on the page
|
||||
|
||||
Scenario: Percentage discount promotion is not applied when the cart
|
||||
has not the required amount
|
||||
Given I am on the store homepage
|
||||
When I add product "Sarge" to cart, with quantity "8"
|
||||
When I add product "Sarge" to cart, with quantity "3"
|
||||
Then I should be on the cart summary page
|
||||
# 8 items should follow '3 items' promotion
|
||||
# 8 items should follow '5 items' promotion
|
||||
And "Promotion total" should not appear on the page
|
||||
And "Grand total: €200.00" should appear on the page
|
||||
And "Grand total: €75.00" should appear on the page
|
||||
|
||||
Scenario: Cart quantity promotion is applied when the cart has the
|
||||
number of items required
|
||||
|
|
@ -63,18 +63,17 @@ Feature: Checkout percentage discount promotions
|
|||
And I added product "Etch" to cart, with quantity "1"
|
||||
When I add product "Lenny" to cart, with quantity "2"
|
||||
Then I should be on the cart summary page
|
||||
# 125 - 25% * 125 = 93.75
|
||||
And "Promotion total: -€31.25" should appear on the page
|
||||
And "Grand total: €93.75" should appear on the page
|
||||
|
||||
Scenario: Cart quantity promotion is not applied when the cart has
|
||||
not the number of items required
|
||||
Given I am on the store homepage
|
||||
When I add product "Etch" to cart, with quantity "8"
|
||||
When I add product "Etch" to cart, with quantity "4"
|
||||
Then I should be on the cart summary page
|
||||
# 8 items should follow '3 items' promotion
|
||||
# 8 items should follow '5 items' promotion
|
||||
And "Promotion total" should not appear on the page
|
||||
And "Grand total: €160.00" should appear on the page
|
||||
And "Grand total: €80.00" should appear on the page
|
||||
|
||||
Scenario: Several promotions are applied when an cart fulfills
|
||||
the rules of several promotions
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ class Order extends Cart implements OrderInterface
|
|||
*/
|
||||
public function getPromotionSubjectCount()
|
||||
{
|
||||
return $this->items->count();
|
||||
return $this->getTotalQuantity();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -342,9 +342,11 @@ class OrderSpec extends ObjectBehavior
|
|||
function it_count_promotions_subjects(OrderItemInterface $item1, OrderItemInterface $item2)
|
||||
{
|
||||
$this->addItem($item1);
|
||||
$item1->getQuantity()->willReturn(4);
|
||||
$this->addItem($item2);
|
||||
$item2->getQuantity()->willReturn(3);
|
||||
|
||||
$this->getPromotionSubjectCount()->shouldReturn(2);
|
||||
$this->getPromotionSubjectCount()->shouldReturn(7);
|
||||
}
|
||||
|
||||
function it_adds_and_removes_promotions(PromotionInterface $promotion)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue