Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f056098

Browse files
committed
[CatalogPromotion] Fixes after rebasing with exclusive promotions feature
1 parent 9287478 commit f056098

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/Sylius/Behat/Context/Setup/CatalogPromotionContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ public function thereIsACatalogPromotionWithPriorityThatReducesPriceByFixedInThe
540540
'configuration' => ['taxons' => [$taxon->getCode()]],
541541
]],
542542
[[
543-
'type' => CatalogPromotionActionInterface::TYPE_PERCENTAGE_DISCOUNT,
544-
'configuration' => ['amount' => $discount],
543+
'type' => CatalogPromotionActionInterface::TYPE_FIXED_DISCOUNT,
544+
'configuration' => [$channel->getCode() => ['amount' => $discount]],
545545
]],
546546
$priority,
547547
);

src/Sylius/Bundle/CoreBundle/spec/Applicator/CatalogPromotionApplicatorSpec.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function it_applies_percentage_discount_on_product_variant(
8989
}
9090

9191
function it_applies_discount_on_product_variant_only_if_exclusive_promotion_is_not_already_applied(
92+
CatalogPromotionPriceCalculatorInterface $priceCalculator,
9293
AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
9394
ProductVariantInterface $variant,
9495
CatalogPromotionInterface $catalogPromotion,
@@ -108,7 +109,6 @@ function it_applies_discount_on_product_variant_only_if_exclusive_promotion_is_n
108109
$variant->getChannelPricingForChannel($secondChannel)->willReturn($secondChannelPricing);
109110

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

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

@@ -119,6 +119,9 @@ function it_applies_discount_on_product_variant_only_if_exclusive_promotion_is_n
119119
$secondChannelPricing->getOriginalPrice()->willReturn(null);
120120
$secondChannelPricing->getMinimumPrice()->willReturn(0);
121121
$secondChannelPricing->setOriginalPrice(1400)->shouldBeCalled();
122+
123+
$priceCalculator->calculate($secondChannelPricing, $catalogPromotionAction)->willReturn(980);
124+
122125
$secondChannelPricing->setPrice(980)->shouldBeCalled();
123126
$secondChannelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldBeCalled();
124127
$catalogPromotion->isExclusive()->willReturn(false);

0 commit comments

Comments
 (0)