当前位置: 首页>>代码示例>>PHP>>正文


PHP OrderItemInterface::getTotal方法代码示例

本文整理汇总了PHP中Sylius\Component\Core\Model\OrderItemInterface::getTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderItemInterface::getTotal方法的具体用法?PHP OrderItemInterface::getTotal怎么用?PHP OrderItemInterface::getTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Component\Core\Model\OrderItemInterface的用法示例。


在下文中一共展示了OrderItemInterface::getTotal方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function it_uses_distributor_and_applicator_to_execute_promotion_action(OrderInterface $order, OrderItemInterface $firstItem, OrderItemInterface $secondItem, PromotionInterface $promotion, ProportionalIntegerDistributorInterface $distributor, UnitsPromotionAdjustmentsApplicatorInterface $unitsPromotionAdjustmentsApplicator)
 {
     $order->countItems()->willReturn(2);
     $order->getItems()->willReturn([$firstItem, $secondItem]);
     $firstItem->getTotal()->willReturn(200);
     $secondItem->getTotal()->willReturn(800);
     $order->getPromotionSubjectTotal()->willReturn(10000);
     $distributor->distribute([200, 800], -1000)->willReturn([-200, -800]);
     $unitsPromotionAdjustmentsApplicator->apply($order, $promotion, [-200, -800])->shouldBeCalled();
     $this->execute($order, ['percentage' => 0.1], $promotion);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:11,代码来源:PercentageDiscountPromotionActionCommandSpec.php

示例2:

 function it_does_not_apply_bigger_promotion_than_promotion_subject_total(OrderInterface $order, OrderItemInterface $firstItem, OrderItemInterface $secondItem, PromotionInterface $promotion, ProportionalIntegerDistributorInterface $proportionalIntegerDistributor, UnitsPromotionAdjustmentsApplicatorInterface $unitsPromotionAdjustmentsApplicator)
 {
     $order->countItems()->willReturn(2);
     $order->getItems()->willReturn(new \ArrayIterator([$firstItem->getWrappedObject(), $secondItem->getWrappedObject()]));
     $order->getPromotionSubjectTotal()->willReturn(10000);
     $firstItem->getTotal()->willReturn(6000);
     $secondItem->getTotal()->willReturn(4000);
     $proportionalIntegerDistributor->distribute([6000, 4000], -10000)->willReturn([-6000, -4000]);
     $unitsPromotionAdjustmentsApplicator->apply($order, $promotion, [-6000, -4000])->shouldBeCalled();
     $this->execute($order, ['amount' => 15000], $promotion);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:11,代码来源:FixedDiscountActionSpec.php

示例3:

 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);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:12,代码来源:TotalOfItemsFromTaxonRuleCheckerSpec.php

示例4:

 function it_does_not_apply_promotions_with_amount_0($adjustmentFactory, $distributor, $originator, $priceRangeFilter, $taxonFilter, AdjustmentInterface $promotionAdjustment1, Collection $originalItems, Collection $units, OrderInterface $order, OrderItemInterface $orderItem1, OrderItemInterface $orderItem2, OrderItemInterface $orderItem3, OrderItemUnitInterface $unit1, OrderItemUnitInterface $unit2, PromotionInterface $promotion)
 {
     $order->getItems()->willReturn($originalItems);
     $originalItems->toArray()->willReturn([$orderItem1, $orderItem2, $orderItem3]);
     $priceRangeFilter->filter([$orderItem1, $orderItem2, $orderItem3], ['percentage' => 0.2, 'filters' => ['taxons' => ['testTaxon']]])->willReturn([$orderItem1, $orderItem2]);
     $taxonFilter->filter([$orderItem1, $orderItem2], ['percentage' => 0.2, 'filters' => ['taxons' => ['testTaxon']]])->willReturn([$orderItem1]);
     $orderItem1->getQuantity()->willReturn(2);
     $orderItem1->getUnits()->willReturn($units);
     $units->getIterator()->willReturn(new \ArrayIterator([$unit1->getWrappedObject(), $unit2->getWrappedObject()]));
     $orderItem1->getTotal()->willReturn(5);
     $distributor->distribute(1, 2)->willReturn([1, 0]);
     $promotion->getDescription()->willReturn('Test description');
     $adjustmentFactory->createNew()->willReturn($promotionAdjustment1);
     $promotionAdjustment1->setType(AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT)->shouldBeCalled();
     $promotionAdjustment1->setLabel('Test description')->shouldBeCalled();
     $promotionAdjustment1->setAmount(-1)->shouldBeCalled();
     $originator->setOrigin($promotionAdjustment1, $promotion)->shouldBeCalled();
     $unit1->addAdjustment($promotionAdjustment1)->shouldBeCalled();
     $unit2->addAdjustment(Argument::any())->shouldNotBeCalled();
     $this->execute($order, ['percentage' => 0.2, 'filters' => ['taxons' => ['testTaxon']]], $promotion);
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:21,代码来源:ItemPercentageDiscountActionSpec.php

示例5:

 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);
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:13,代码来源:OrderSpec.php

示例6: tax

 function it_does_not_apply_taxes_with_amount_0($adjustmentsFactory, $calculator, $distributor, $taxRateResolver, Collection $items, Collection $units, OrderInterface $order, OrderItemInterface $orderItem, OrderItemUnitInterface $unit1, OrderItemUnitInterface $unit2, ProductVariantInterface $productVariant, TaxRateInterface $taxRate, ZoneInterface $zone)
 {
     $order->getItems()->willReturn($items);
     $items->count()->willReturn(1);
     $items->getIterator()->willReturn(new \ArrayIterator([$orderItem->getWrappedObject()]));
     $orderItem->getQuantity()->willReturn(2);
     $orderItem->getVariant()->willReturn($productVariant);
     $taxRateResolver->resolve($productVariant, ['zone' => $zone])->willReturn($taxRate);
     $orderItem->getTotal()->willReturn(1000);
     $calculator->calculate(1000, $taxRate)->willReturn(0);
     $taxRate->getLabel()->willReturn('Simple tax (0%)');
     $taxRate->isIncludedInPrice()->willReturn(false);
     $orderItem->getUnits()->willReturn($units);
     $units->getIterator()->willReturn(new \ArrayIterator([$unit1->getWrappedObject(), $unit2->getWrappedObject()]));
     $distributor->distribute(0, 2)->willReturn([0, 0]);
     $adjustmentsFactory->createWithData(AdjustmentInterface::TAX_ADJUSTMENT, 'Simple tax (0%)', 0, false)->shouldNotBeCalled();
     $this->apply($order, $zone);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:18,代码来源:OrderItemsTaxesApplicatorSpec.php

示例7:

 function it_not_a_backorder_if_contains_no_backordered_units(InventoryUnitInterface $unit1, InventoryUnitInterface $unit2, OrderItemInterface $item)
 {
     $unit1->getInventoryState()->willReturn(InventoryUnitInterface::STATE_SOLD);
     $unit2->getInventoryState()->willReturn(InventoryUnitInterface::STATE_SOLD);
     $item->getUnits()->willReturn([$unit1, $unit2]);
     $item->getTotal()->willReturn(4000);
     $item->setOrder($this)->shouldBeCalled();
     $this->addItem($item);
     $this->shouldNotBeBackorder();
 }
开发者ID:stevedien,项目名称:Sylius,代码行数:10,代码来源:OrderSpec.php

示例8: ArrayCollection

 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);
 }
开发者ID:sylius,项目名称:core,代码行数:14,代码来源:TotalOfItemsFromTaxonRuleCheckerSpec.php

示例9:

 function it_returns_promotions_total_recursively(AdjustmentInterface $orderPromotionAdjustment, AdjustmentInterface $orderItemPromotionAdjustment, OrderItemInterface $orderItem)
 {
     $orderPromotionAdjustment->getAmount()->willReturn(10000);
     $orderItemPromotionAdjustment->getAmount()->willReturn(5000);
     $orderPromotionAdjustment->isNeutral()->willReturn(false);
     $orderItemPromotionAdjustment->isNeutral()->willReturn(false);
     $orderPromotionAdjustment->getType()->willReturn(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT);
     $orderItemPromotionAdjustment->getType()->willReturn(AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT);
     $orderPromotionAdjustment->setAdjustable($this)->shouldBeCalled();
     $orderItem->getAdjustmentsRecursively(AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT)->willReturn([$orderItemPromotionAdjustment]);
     $orderItem->setOrder($this)->shouldBeCalled();
     $orderItem->getTotal()->willReturn(15000);
     $orderItem->getAdjustmentsRecursively(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)->willReturn([]);
     $this->addItem($orderItem);
     $this->addAdjustment($orderPromotionAdjustment);
     $this->getPromotionsTotalRecursively()->shouldReturn(15000);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:17,代码来源:OrderSpec.php


注:本文中的Sylius\Component\Core\Model\OrderItemInterface::getTotal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。