function it_uses_decorated_checker_to_check_eligibility_for_order_channel(ChannelInterface $channel, OrderInterface $order, RuleCheckerInterface $itemTotalRuleChecker) { $order->getChannel()->willReturn($channel); $channel->getCode()->willReturn('WEB_US'); $itemTotalRuleChecker->isEligible($order, ['amount' => 1000])->willReturn(true); $this->isEligible($order, ['WEB_US' => ['amount' => 1000]])->shouldReturn(true); }
/** * {@inheritdoc} */ public function isEligible(PromotionSubjectInterface $subject, array $configuration) { Assert::isInstanceOf($subject, OrderInterface::class); $channelCode = $subject->getChannel()->getCode(); if (!isset($configuration[$channelCode])) { return false; } return $this->itemTotalRuleChecker->isEligible($subject, $configuration[$channelCode]); }
function let(ServiceRegistryInterface $registry, RuleCheckerInterface $checker, FormFactoryInterface $factory) { $checker->getConfigurationFormType()->willReturn('sylius_promotion_rule_item_total_configuration'); $registry->get(ItemTotalRuleChecker::TYPE)->willReturn($checker); $this->beConstructedWith($registry, $factory); }