/**
  * {@inheritdoc}
  */
 public function getPromotions(PromotionSubjectInterface $subject)
 {
     if (!$subject instanceof OrderInterface) {
         throw new UnexpectedTypeException($subject, OrderInterface::class);
     }
     $channel = $subject->getChannel();
     $promotions = $this->promotionRepository->findActiveByChannel($channel);
     return $promotions;
 }
 /**
  * {@inheritdoc}
  */
 public function getPromotions(PromotionSubjectInterface $subject)
 {
     if (!$subject instanceof OrderInterface) {
         throw new UnexpectedTypeException($subject, OrderInterface::class);
     }
     $channel = $subject->getChannel();
     if (null === $channel) {
         throw new \InvalidArgumentException('Order has no channel, but it should.');
     }
     $promotions = $this->promotionRepository->findActiveByChannel($channel);
     return $promotions;
 }
 function it_provides_an_active_promotions_for_given_subject_channel(PromotionRepositoryInterface $promotionRepository, ChannelInterface $channel, PromotionInterface $promotion1, PromotionInterface $promotion2, OrderInterface $subject)
 {
     $subject->getChannel()->willReturn($channel);
     $promotionRepository->findActiveByChannel($channel)->willReturn([$promotion1, $promotion2]);
     $this->getPromotions($subject)->shouldReturn([$promotion1, $promotion2]);
 }