Skip to content

Commit

Permalink
[CatalogPromotion] Fixes after rebasing with exclusive promotions fea…
Browse files Browse the repository at this point in the history
…ture
  • Loading branch information
GSadee committed Nov 25, 2021
1 parent 9287478 commit f056098
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Context/Setup/CatalogPromotionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,8 @@ public function thereIsACatalogPromotionWithPriorityThatReducesPriceByFixedInThe
'configuration' => ['taxons' => [$taxon->getCode()]],
]],
[[
'type' => CatalogPromotionActionInterface::TYPE_PERCENTAGE_DISCOUNT,
'configuration' => ['amount' => $discount],
'type' => CatalogPromotionActionInterface::TYPE_FIXED_DISCOUNT,
'configuration' => [$channel->getCode() => ['amount' => $discount]],
]],
$priority,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function it_applies_percentage_discount_on_product_variant(
}

function it_applies_discount_on_product_variant_only_if_exclusive_promotion_is_not_already_applied(
CatalogPromotionPriceCalculatorInterface $priceCalculator,
AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
ProductVariantInterface $variant,
CatalogPromotionInterface $catalogPromotion,
Expand All @@ -108,7 +109,6 @@ function it_applies_discount_on_product_variant_only_if_exclusive_promotion_is_n
$variant->getChannelPricingForChannel($secondChannel)->willReturn($secondChannelPricing);

$appliedPromotionInformationFormatter->format($catalogPromotion)->willReturn(['winter_sale' => ['name' => 'Winter sale']]);
$catalogPromotionAction->getConfiguration()->willReturn(['amount' => 0.3]);

$firstChannelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(true);

Expand All @@ -119,6 +119,9 @@ function it_applies_discount_on_product_variant_only_if_exclusive_promotion_is_n
$secondChannelPricing->getOriginalPrice()->willReturn(null);
$secondChannelPricing->getMinimumPrice()->willReturn(0);
$secondChannelPricing->setOriginalPrice(1400)->shouldBeCalled();

$priceCalculator->calculate($secondChannelPricing, $catalogPromotionAction)->willReturn(980);

$secondChannelPricing->setPrice(980)->shouldBeCalled();
$secondChannelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldBeCalled();
$catalogPromotion->isExclusive()->willReturn(false);
Expand Down

0 comments on commit f056098

Please sign in to comment.