function it_executes_request(InvoiceNumberGeneratorInterface $invoiceNumberGenerator, CurrencyConverterInterface $currencyConverter, Convert $request, PaymentInterface $payment, OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $productVariant, ProductInterface $product)
 {
     $request->getTo()->willReturn('array');
     $payment->getId()->willReturn(19);
     $order->getId()->willReturn(92);
     $order->getId()->willReturn(92);
     $order->getCurrencyCode()->willReturn('PLN');
     $order->getTotal()->willReturn(22000);
     $order->getItems()->willReturn([$orderItem]);
     $order->getAdjustmentsTotalRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->willReturn(0);
     $order->getOrderPromotionTotal()->willReturn(0);
     $order->getShippingTotal()->willReturn(2000);
     $orderItem->getVariant()->willReturn($productVariant);
     $orderItem->getDiscountedUnitPrice()->willReturn(20000);
     $orderItem->getQuantity()->willReturn(1);
     $productVariant->getProduct()->willReturn($product);
     $product->getName()->willReturn('Lamborghini Aventador Model');
     $request->getSource()->willReturn($payment);
     $payment->getOrder()->willReturn($order);
     $invoiceNumberGenerator->generate($order, $payment)->willReturn('19-92');
     $currencyConverter->convertFromBase(22000, 'PLN')->willReturn(88000);
     $currencyConverter->convertFromBase(20000, 'PLN')->willReturn(80000);
     $currencyConverter->convertFromBase(2000, 'PLN')->willReturn(8000);
     $details = ['PAYMENTREQUEST_0_INVNUM' => '19-92', 'PAYMENTREQUEST_0_CURRENCYCODE' => 'PLN', 'PAYMENTREQUEST_0_AMT' => 880.0, 'PAYMENTREQUEST_0_ITEMAMT' => 880.0, 'L_PAYMENTREQUEST_0_NAME0' => 'Lamborghini Aventador Model', 'L_PAYMENTREQUEST_0_AMT0' => 800.0, 'L_PAYMENTREQUEST_0_QTY0' => 1, 'L_PAYMENTREQUEST_0_NAME1' => 'Shipping Total', 'L_PAYMENTREQUEST_0_AMT1' => 80.0, 'L_PAYMENTREQUEST_0_QTY1' => 1];
     $request->setResult($details)->shouldBeCalled();
     $this->execute($request);
 }
 function it_returns_regular_price_of_discount_order_item(OrderItemInterface $orderItem)
 {
     $orderItem->getQuantity()->willReturn(2);
     $orderItem->getUnitPrice()->willReturn(1000);
     $orderItem->getAdjustmentsTotalRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->willReturn(1000);
     $this->getRegularPrice($orderItem)->shouldReturn(3000);
 }
 function it_filters_items_which_has_product_with_price_equal_to_configured_minimum_criteria(OrderItemInterface $item1, OrderItemInterface $item2, ProductVariantInterface $item1Variant, ProductVariantInterface $item2Variant)
 {
     $item1->getVariant()->willReturn($item1Variant);
     $item2->getVariant()->willReturn($item2Variant);
     $item1Variant->getPrice()->willReturn(500);
     $item2Variant->getPrice()->willReturn(1000);
     $this->filter([$item1, $item2], ['filters' => ['price_range' => ['min' => 1000]]])->shouldReturn([$item2]);
 }
Beispiel #4
0
 function it_filters_passed_order_items_with_given_configuration(OrderItemInterface $item1, OrderItemInterface $item2, ProductInterface $product1, ProductInterface $product2)
 {
     $item1->getProduct()->willReturn($product1);
     $product1->getCode()->willReturn('product1');
     $item2->getProduct()->willReturn($product2);
     $product2->getCode()->willReturn('product2');
     $this->filter([$item1, $item2], ['filters' => ['products_filter' => ['products' => ['product1']]]])->shouldReturn([$item1]);
 }
 function it_does_nothing_if_target_quantity_is_below_0($orderItemUnitFactory, OrderItemInterface $orderItem)
 {
     $orderItem->getQuantity()->willReturn(3);
     $orderItemUnitFactory->createForItem(Argument::any())->shouldNotBeCalled();
     $orderItem->addUnit(Argument::any())->shouldNotBeCalled();
     $orderItem->removeUnit(Argument::any())->shouldNotBeCalled();
     $this->modify($orderItem, -10);
 }
Beispiel #6
0
 function it_filters_items_which_has_product_with_price_equal_to_configured_minimum_criteria(ChannelInterface $channel, OrderItemInterface $item1, OrderItemInterface $item2, ProductVariantInterface $item1Variant, ProductVariantInterface $item2Variant, ProductVariantPriceCalculatorInterface $productVariantPriceCalculator)
 {
     $item1->getVariant()->willReturn($item1Variant);
     $item2->getVariant()->willReturn($item2Variant);
     $productVariantPriceCalculator->calculate($item1Variant, ['channel' => $channel])->willReturn(500);
     $productVariantPriceCalculator->calculate($item2Variant, ['channel' => $channel])->willReturn(1000);
     $this->filter([$item1, $item2], ['filters' => ['price_range_filter' => ['min' => 1000]], 'channel' => $channel])->shouldReturn([$item2]);
 }
 function it_recognizes_a_subject_as_not_eligible_if_a_product_taxon_is_not_matched(OrderInterface $subject, OrderItemInterface $item, ProductInterface $reflexBow, TaxonInterface $bows)
 {
     $configuration = ['taxons' => ['swords', 'axes']];
     $bows->getCode()->willReturn('bows');
     $reflexBow->getTaxons()->willReturn([$bows]);
     $item->getProduct()->willReturn($reflexBow);
     $subject->getItems()->willReturn([$item]);
     $this->isEligible($subject, $configuration)->shouldReturn(false);
 }
 function it_returns_false_if_product_is_wrong(OrderInterface $subject, OrderItemInterface $firstOrderItem, OrderItemInterface $secondOrderItem, ProductInterface $shaft, ProductInterface $head)
 {
     $subject->getItems()->willReturn([$firstOrderItem, $secondOrderItem]);
     $firstOrderItem->getProduct()->willReturn($head);
     $secondOrderItem->getProduct()->willReturn($shaft);
     $head->getCode()->willReturn('LACROSSE_HEAD');
     $shaft->getCode()->willReturn('LACROSSE_SHAFT');
     $this->isEligible($subject, ['product_code' => 'LACROSSE_STRING'])->shouldReturn(false);
 }
 function it_should_recognize_subject_as_not_eligible_if_product_taxonomy_is_matched_and_exclude_is_set(OrderInterface $subject, OrderItemInterface $item, Taxon $taxon, Product $product, ArrayCollection $collection)
 {
     $configuration = ['taxons' => $collection, 'exclude' => true];
     $collection->contains(2)->willReturn(true);
     $taxon->getId()->willReturn(2);
     $product->getTaxons()->willReturn([$taxon]);
     $item->getProduct()->willReturn($product);
     $subject->getItems()->willReturn([$item]);
     $this->isEligible($subject, $configuration)->shouldReturn(false);
 }
 /**
  * @param OrderItemInterface $item
  * @param array $configuration
  *
  * @return bool
  */
 private function isItemEligible(OrderItemInterface $item, array $configuration)
 {
     if (!$configuration['exclude']) {
         if (isset($configuration['count'])) {
             return $this->isItemQuantityEligible($item->getQuantity(), $configuration);
         }
         return true;
     }
     return false;
 }
 function it_throws_exception_when_recalculated_on_hand_quantity_is_lower_than_zero(OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $productVariant)
 {
     $order->getItems()->willReturn([$orderItem]);
     $orderItem->getQuantity()->willReturn(5);
     $orderItem->getVariant()->willReturn($productVariant);
     $productVariant->isTracked()->willReturn(true);
     $productVariant->getOnHand()->willReturn(4);
     $productVariant->getName()->willReturn('Variant');
     $this->shouldThrow(\InvalidArgumentException::class)->during('decrease', [$order]);
 }
 /**
  * @param OrderItemInterface $item
  * @param array $distributedAmounts
  * @param PromotionInterface $promotion
  */
 private function setUnitsAdjustments(OrderItemInterface $item, array $distributedAmounts, PromotionInterface $promotion)
 {
     $i = 0;
     foreach ($item->getUnits() as $unit) {
         if (0 === $distributedAmounts[$i]) {
             break;
         }
         $this->addAdjustmentToUnit($unit, $distributedAmounts[$i], $promotion);
         $i++;
     }
 }
 function it_does_not_process_taxes_if_there_is_no_tax_zone(ZoneProviderInterface $defaultTaxZoneProvider, ZoneMatcherInterface $zoneMatcher, PrioritizedServiceRegistryInterface $strategyRegistry, OrderInterface $order, OrderItemInterface $orderItem, AddressInterface $address)
 {
     $order->getItems()->willReturn([$orderItem]);
     $order->isEmpty()->willReturn(false);
     $order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $orderItem->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getShippingAddress()->willReturn($address);
     $zoneMatcher->match($address)->willReturn(null);
     $defaultTaxZoneProvider->getZone($order)->willReturn(null);
     $strategyRegistry->all()->shouldNotBeCalled();
     $this->process($order);
 }
 /**
  * @param OrderItemInterface $item
  * @param PromotionInterface $promotion
  * @param int $itemPromotionAmount
  */
 private function applyAdjustmentsOnItemUnits(OrderItemInterface $item, PromotionInterface $promotion, $itemPromotionAmount)
 {
     $splitPromotionAmount = $this->distributor->distribute($itemPromotionAmount, $item->getQuantity());
     $i = 0;
     foreach ($item->getUnits() as $unit) {
         $promotionAmount = $splitPromotionAmount[$i++];
         if (0 === $promotionAmount) {
             continue;
         }
         $this->addAdjustment($promotion, $unit, $promotionAmount);
     }
 }
 function it_does_not_recognize_a_subject_as_eligible_if_items_from_required_taxon_has_too_low_total(TaxonRepositoryInterface $taxonRepository, OrderInterface $order, OrderItemInterface $compositeBowItem, OrderItemInterface $longswordItem, ProductInterface $compositeBow, ProductInterface $longsword, TaxonInterface $bows)
 {
     $order->getItems()->willReturn([$compositeBowItem, $longswordItem]);
     $taxonRepository->findOneBy(['code' => 'bows'])->willReturn($bows);
     $compositeBowItem->getProduct()->willReturn($compositeBow);
     $compositeBow->hasTaxon($bows)->willReturn(true);
     $compositeBowItem->getTotal()->willReturn(5000);
     $longswordItem->getProduct()->willReturn($longsword);
     $longsword->hasTaxon($bows)->willReturn(false);
     $longswordItem->getTotal()->willReturn(4000);
     $this->isEligible($order, ['taxon' => 'bows', 'amount' => 10000])->shouldReturn(false);
 }
 function it_recalculates_prices_without_adding_anything_to_the_context_if_its_not_needed(DelegatingCalculatorInterface $priceCalculator, OrderInterface $order, OrderItemInterface $item, PriceableInterface $variant)
 {
     $order->getCustomer()->willReturn(null);
     $order->getChannel()->willReturn(null);
     $order->getItems()->willReturn([$item]);
     $item->isImmutable()->willReturn(false);
     $item->getQuantity()->willReturn(5);
     $item->getVariant()->willReturn($variant);
     $priceCalculator->calculate($variant, ['quantity' => 5])->willReturn(10);
     $item->setUnitPrice(10)->shouldBeCalled();
     $this->process($order);
 }
 function it_reverts_order_units_order_promotion_adjustments(AdjustmentInterface $firstAdjustment, AdjustmentInterface $secondAdjustment, OrderInterface $order, OrderItemInterface $item, OrderItemUnitInterface $unit, OriginatorInterface $originator, PromotionInterface $otherPromotion, PromotionInterface $promotion)
 {
     $order->countItems()->willReturn(1);
     $order->getItems()->willReturn(new \ArrayIterator([$item->getWrappedObject()]));
     $item->getUnits()->willReturn(new \ArrayIterator([$unit->getWrappedObject()]));
     $unit->getAdjustments(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)->willReturn(new \ArrayIterator([$firstAdjustment->getWrappedObject(), $secondAdjustment->getWrappedObject()]));
     $originator->getOrigin($firstAdjustment)->willReturn($promotion);
     $originator->getOrigin($secondAdjustment)->willReturn($otherPromotion);
     $unit->removeAdjustment($firstAdjustment)->shouldBeCalled();
     $unit->removeAdjustment($secondAdjustment)->shouldNotBeCalled();
     $this->revert($order, [], $promotion);
 }
 function it_does_not_check_an_item_if_its_product_has_no_required_taxon(OrderInterface $order, OrderItemInterface $compositeBowItem, OrderItemInterface $longswordItem, ProductInterface $compositeBow, ProductInterface $longsword, TaxonInterface $bows, TaxonRepositoryInterface $taxonRepository)
 {
     $order->getItems()->willReturn(new \ArrayIterator([$compositeBowItem->getWrappedObject(), $longswordItem->getWrappedObject()]));
     $taxonRepository->findOneBy(['code' => 'bows'])->willReturn($bows);
     $compositeBowItem->getProduct()->willReturn($compositeBow);
     $compositeBow->hasTaxon($bows)->willReturn(true);
     $compositeBowItem->getQuantity()->willReturn(4);
     $longswordItem->getProduct()->willReturn($longsword);
     $longsword->hasTaxon($bows)->willReturn(false);
     $longswordItem->getQuantity()->shouldNotBeCalled();
     $this->isEligible($order, ['taxon' => 'bows', 'count' => 5])->shouldReturn(false);
 }
 function it_reverts_order_units_order_promotion_adjustments(AdjustmentInterface $firstAdjustment, AdjustmentInterface $secondAdjustment, OrderInterface $order, OrderItemInterface $item, OrderItemUnitInterface $unit, PromotionInterface $promotion)
 {
     $order->countItems()->willReturn(1);
     $order->getItems()->willReturn([$item]);
     $item->getUnits()->willReturn([$unit]);
     $unit->getAdjustments(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)->willReturn([$firstAdjustment, $secondAdjustment]);
     $promotion->getCode()->willReturn('PROMOTION');
     $firstAdjustment->getOriginCode()->willReturn('PROMOTION');
     $secondAdjustment->getOriginCode()->willReturn('OTHER_PROMOTION');
     $unit->removeAdjustment($firstAdjustment)->shouldBeCalled();
     $unit->removeAdjustment($secondAdjustment)->shouldNotBeCalled();
     $this->revert($order, [], $promotion);
 }
 function it_reverts_proper_promotion_adjustment_from_all_units($originator, AdjustmentInterface $promotionAdjustment1, AdjustmentInterface $promotionAdjustment2, Collection $items, Collection $units, Collection $adjustments, OrderInterface $order, OrderItemInterface $orderItem, OrderItemUnitInterface $unit, PromotionInterface $promotion, PromotionInterface $someOtherPromotion)
 {
     $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()]));
     $originator->getOrigin($promotionAdjustment1)->willReturn($promotion);
     $unit->removeAdjustment($promotionAdjustment1)->shouldBeCalled();
     $originator->getOrigin($promotionAdjustment2)->willReturn($someOtherPromotion);
     $unit->removeAdjustment($promotionAdjustment2)->shouldNotBeCalled();
     $this->revert($order, ['percentage' => 0.2], $promotion);
 }
 function it_recalculates_prices_adding_customer_to_the_context(ChannelInterface $channel, CustomerGroupInterface $group, CustomerInterface $customer, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, ProductVariantPriceCalculatorInterface $productVariantPriceCalculator)
 {
     $order->getCustomer()->willReturn($customer);
     $order->getChannel()->willReturn(null);
     $order->getItems()->willReturn([$item]);
     $order->getCurrencyCode()->willReturn(null);
     $customer->getGroup()->willReturn($group);
     $item->isImmutable()->willReturn(false);
     $item->getQuantity()->willReturn(5);
     $item->getVariant()->willReturn($variant);
     $order->getChannel()->willReturn($channel);
     $productVariantPriceCalculator->calculate($variant, ['channel' => $channel])->willReturn(10);
     $item->setUnitPrice(10)->shouldBeCalled();
     $this->process($order);
 }
 function it_holds_the_variant_stock_via_inventory_operator($inventoryOperator, $stateMachineFactory, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, OrderItemUnitInterface $unit1, OrderItemUnitInterface $unit2, StateMachineInterface $sm1, StateMachineInterface $sm2)
 {
     $order->getItems()->willReturn([$item]);
     $item->getVariant()->willReturn($variant);
     $item->getQuantity()->willReturn(2);
     $item->getUnits()->willReturn(new ArrayCollection([$unit1, $unit2]));
     $stateMachineFactory->get($unit1, InventoryUnitTransitions::GRAPH)->willReturn($sm1);
     $sm1->can(InventoryUnitTransitions::SYLIUS_HOLD)->willReturn(false);
     $sm1->apply(InventoryUnitTransitions::SYLIUS_HOLD)->shouldNotBeCalled();
     $stateMachineFactory->get($unit2, InventoryUnitTransitions::GRAPH)->willReturn($sm2);
     $sm1->can(InventoryUnitTransitions::SYLIUS_HOLD)->willReturn(true);
     $sm1->apply(InventoryUnitTransitions::SYLIUS_HOLD)->shouldBeCalled();
     $inventoryOperator->hold($variant, 1)->shouldBeCalled();
     $this->holdInventory($order);
 }
 function it_recalculates_prices_adding_all_context(GenericEvent $event, OrderInterface $order, OrderItemInterface $item, DelegatingCalculatorInterface $priceCalculator, GroupableInterface $customer, ArrayCollection $groups, ChannelInterface $channel, PriceableInterface $variant)
 {
     $event->getSubject()->shouldBeCalled()->willReturn($order);
     $order->getCustomer()->shouldBeCalled()->willReturn($customer);
     $order->getChannel()->shouldBeCalled()->willReturn($channel);
     $order->getItems()->shouldBeCalled()->willReturn(array($item));
     $order->calculateTotal()->shouldBeCalled();
     $customer->getGroups()->shouldBeCalled()->willReturn($groups);
     $groups->toArray()->shouldBeCalled()->willReturn(array('group1', 'group2'));
     $item->isImmutable()->shouldBeCalled()->willReturn(false);
     $item->getQuantity()->shouldBeCalled()->willReturn(5);
     $item->setUnitPrice(10)->shouldBeCalled();
     $item->getVariant()->shouldBeCalled()->willReturn($variant);
     $priceCalculator->calculate($variant, array('customer' => $customer, 'groups' => array('group1', 'group2'), 'channel' => array($channel), 'quantity' => 5))->shouldBeCalled()->willReturn(10);
     $this->recalculatePrices($event);
 }
 function it_removes_invalid_cart_items($cartProvider, $restrictedZoneChecker, $session, $translator, $cartManager, OrderItemInterface $item, GenericEvent $event, OrderInterface $cart, ProductInterface $product, AddressInterface $address, FlashBag $flashBag)
 {
     $event->getSubject()->willReturn($cart);
     $cartProvider->getCart()->shouldNotBeCalled();
     $item->getProduct()->willReturn($product);
     $product->getName()->willReturn('invalid');
     $cart->getItems()->willReturn([$item]);
     $cart->getShippingAddress()->willReturn($address);
     $cart->removeItem($item)->shouldBeCalled();
     $restrictedZoneChecker->isRestricted($product, $address)->willReturn(true);
     $session->getBag('flashes')->willReturn($flashBag);
     $flashBag->add('error', Argument::any())->shouldBeCalled();
     $translator->trans('sylius.cart.restricted_zone_removal', ['%product%' => 'invalid'], 'flashes')->shouldBeCalled();
     $cartManager->persist($cart)->shouldBeCalled();
     $cartManager->flush()->shouldBeCalled();
     $this->handleRestrictedZone($event);
 }
 function it_decreases_the_variant_stock_via_inventory_operator($inventoryOperator, $stateMachineFactory, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, OrderItemUnitInterface $unit1, OrderItemUnitInterface $unit2, StateMachineInterface $sm1, StateMachineInterface $sm2)
 {
     $order->getItems()->willReturn([$item]);
     $item->getVariant()->willReturn($variant);
     $item->getQuantity()->willReturn(2);
     $item->getUnits()->shouldBeCalled()->willReturn([$unit1, $unit2]);
     $stateMachineFactory->get($unit1, InventoryUnitTransitions::GRAPH)->willReturn($sm1);
     $sm1->can(InventoryUnitTransitions::SYLIUS_SELL)->willReturn(true);
     $sm1->can(InventoryUnitTransitions::SYLIUS_RELEASE)->willReturn(true);
     $sm1->apply(InventoryUnitTransitions::SYLIUS_SELL)->shouldBeCalled();
     $stateMachineFactory->get($unit2, InventoryUnitTransitions::GRAPH)->willReturn($sm2);
     $sm2->can(InventoryUnitTransitions::SYLIUS_SELL)->willReturn(true);
     $sm2->can(InventoryUnitTransitions::SYLIUS_RELEASE)->willReturn(false);
     $sm2->apply(InventoryUnitTransitions::SYLIUS_SELL)->shouldBeCalled();
     $inventoryOperator->decrease([$unit1, $unit2])->shouldBeCalled();
     $inventoryOperator->release($variant, 1)->shouldBeCalled();
     $this->updateInventory($order);
 }
 function it_does_not_recognize_a_subject_as_eligible_if_items_from_required_taxon_has_too_low_total(ChannelInterface $channel, OrderInterface $order, OrderItemInterface $compositeBowItem, OrderItemInterface $longswordItem, ProductInterface $compositeBow, ProductInterface $longsword, ProductTaxonInterface $bowsProductTaxon, TaxonInterface $bows, TaxonRepositoryInterface $taxonRepository)
 {
     $order->getChannel()->willReturn($channel);
     $channel->getCode()->willReturn('WEB_US');
     $order->getItems()->willReturn([$compositeBowItem, $longswordItem]);
     $taxonRepository->findOneBy(['code' => 'bows'])->willReturn($bows);
     $compositeBowItem->getProduct()->willReturn($compositeBow);
     $compositeBow->filterProductTaxonsByTaxon($bows)->willReturn(new ArrayCollection([$bowsProductTaxon]));
     $compositeBowItem->getTotal()->willReturn(5000);
     $longswordItem->getProduct()->willReturn($longsword);
     $longsword->filterProductTaxonsByTaxon($bows)->willReturn(new ArrayCollection([]));
     $longswordItem->getTotal()->willReturn(4000);
     $this->isEligible($order, ['WEB_US' => ['taxon' => 'bows', 'amount' => 10000]])->shouldReturn(false);
 }
 protected function createInventoryUnits(OrderItemInterface $item, $quantity, $state = InventoryUnitInterface::STATE_CHECKOUT)
 {
     $units = $this->inventoryUnitFactory->create($item->getVariant(), $quantity, $state);
     foreach ($units as $unit) {
         $item->addInventoryUnit($unit);
     }
 }
 function it_does_nothing_if_variant_is_not_tracked_during_selling(OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $variant)
 {
     $order->getItems()->willReturn([$orderItem]);
     $orderItem->getVariant()->willReturn($variant);
     $variant->isTracked()->willReturn(false);
     $variant->setOnHold(Argument::any())->shouldNotBeCalled();
     $variant->setOnHand(Argument::any())->shouldNotBeCalled();
     $this->sell($order);
 }
Beispiel #29
0
 function it_does_not_include_shipping_promotion_adjustment_in_order_promotion_total(AdjustmentInterface $shippingPromotionAdjustment, OrderItemInterface $orderItem1)
 {
     $orderItem1->getTotal()->willReturn(500);
     $orderItem1->getAdjustmentsTotalRecursively(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)->willReturn(-400);
     $shippingPromotionAdjustment->getType()->willReturn(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT);
     $shippingPromotionAdjustment->isNeutral()->willReturn(false);
     $shippingPromotionAdjustment->getAmount()->willReturn(-100);
     $orderItem1->setOrder($this)->shouldBeCalled();
     $this->addItem($orderItem1);
     $shippingPromotionAdjustment->setAdjustable($this)->shouldBeCalled();
     $this->addAdjustment($shippingPromotionAdjustment);
     $this->getOrderPromotionTotal()->shouldReturn(-400);
 }
 function it_returns_only_sum_of_neutral_and_non_neutral_tax_adjustments_as_tax_total(OrderItemInterface $orderItem, AdjustmentInterface $nonNeutralTaxAdjustment, AdjustmentInterface $neutralTaxAdjustment, AdjustmentInterface $notTaxAdjustment)
 {
     $neutralTaxAdjustment->isNeutral()->willReturn(true);
     $neutralTaxAdjustment->getType()->willReturn(AdjustmentInterface::TAX_ADJUSTMENT);
     $neutralTaxAdjustment->getAmount()->willReturn(200);
     $nonNeutralTaxAdjustment->isNeutral()->willReturn(false);
     $nonNeutralTaxAdjustment->getType()->willReturn(AdjustmentInterface::TAX_ADJUSTMENT);
     $nonNeutralTaxAdjustment->getAmount()->willReturn(300);
     $notTaxAdjustment->isNeutral()->willReturn(false);
     $notTaxAdjustment->getType()->willReturn(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT);
     $notTaxAdjustment->getAmount()->willReturn(100);
     $orderItem->recalculateUnitsTotal()->shouldBeCalled();
     $neutralTaxAdjustment->setAdjustable($this)->shouldBeCalled();
     $nonNeutralTaxAdjustment->setAdjustable($this)->shouldBeCalled();
     $notTaxAdjustment->setAdjustable($this)->shouldBeCalled();
     $this->addAdjustment($neutralTaxAdjustment);
     $this->addAdjustment($nonNeutralTaxAdjustment);
     $this->addAdjustment($notTaxAdjustment);
     $this->getTaxTotal()->shouldReturn(500);
 }