function it_reverts_a_proper_promotion_adjustment_from_all_units(AdjustmentInterface $promotionAdjustment1, AdjustmentInterface $promotionAdjustment2, Collection $items, Collection $units, Collection $adjustments, OrderInterface $order, OrderItemInterface $orderItem, OrderItemUnitInterface $unit, PromotionInterface $promotion)
 {
     $order->getItems()->willReturn($items);
     $items->getIterator()->willReturn(new \ArrayIterator([$orderItem->getWrappedObject()]));
     $orderItem->getUnits()->willReturn($units);
     $units->getIterator()->willReturn(new \ArrayIterator([$unit->getWrappedObject()]));
     $unit->getAdjustments(AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT)->willReturn($adjustments);
     $adjustments->getIterator()->willReturn(new \ArrayIterator([$promotionAdjustment1->getWrappedObject(), $promotionAdjustment2->getWrappedObject()]));
     $promotion->getCode()->willReturn('PROMOTION');
     $promotionAdjustment1->getOriginCode()->willReturn('PROMOTION');
     $unit->removeAdjustment($promotionAdjustment1)->shouldBeCalled();
     $promotionAdjustment2->getOriginCode()->willReturn('OTHER_PROMOTION');
     $unit->removeAdjustment($promotionAdjustment2)->shouldNotBeCalled();
     $this->revert($order, ['percentage' => 0.2], $promotion);
 }
コード例 #2
0
 /**
  * @Then /^(this promotion) should no longer exist in the promotion registry$/
  */
 public function promotionShouldNotExistInTheRegistry(PromotionInterface $promotion)
 {
     $this->indexPage->open();
     Assert::false($this->indexPage->isSingleResourceOnPage(['code' => $promotion->getCode()]), sprintf('Promotion with code %s exists but should not.', $promotion->getCode()));
 }
コード例 #3
0
 function it_reverts_a_proper_promotion_adjustment_from_all_units(AdjustmentInterface $promotionAdjustment1, AdjustmentInterface $promotionAdjustment2, ChannelInterface $channel, OrderInterface $order, OrderItemInterface $orderItem, OrderItemUnitInterface $unit, PromotionInterface $promotion)
 {
     $order->getChannel()->willReturn($channel);
     $channel->getCode()->willReturn('WEB_US');
     $order->getItems()->willReturn(new ArrayCollection([$orderItem->getWrappedObject()]));
     $orderItem->getUnits()->willReturn(new ArrayCollection([$unit->getWrappedObject()]));
     $unit->getAdjustments(AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT)->willReturn(new ArrayCollection([$promotionAdjustment1->getWrappedObject(), $promotionAdjustment2->getWrappedObject()]));
     $promotion->getCode()->willReturn('PROMOTION');
     $promotionAdjustment1->getOriginCode()->willReturn('PROMOTION');
     $unit->removeAdjustment($promotionAdjustment1)->shouldBeCalled();
     $promotionAdjustment2->getOriginCode()->willReturn('OTHER_PROMOTION');
     $unit->removeAdjustment($promotionAdjustment2)->shouldNotBeCalled();
     $this->revert($order, ['WEB_US' => ['amount' => 1000]], $promotion);
 }