本文整理汇总了PHP中Sylius\Component\Core\Model\OrderItemInterface::getWrappedObject方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderItemInterface::getWrappedObject方法的具体用法?PHP OrderItemInterface::getWrappedObject怎么用?PHP OrderItemInterface::getWrappedObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Core\Model\OrderItemInterface
的用法示例。
在下文中一共展示了OrderItemInterface::getWrappedObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
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);
}
示例2:
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);
}
示例3:
function it_does_not_recognize_subject_as_eligible_if_items_from_required_taxon_has_too_low_total(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->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);
}
示例4:
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);
}
示例5:
function it_does_not_apply_taxes_with_amount_0(CalculatorInterface $calculator, AdjustmentFactoryInterface $adjustmentsFactory, TaxRateResolverInterface $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(2);
$items->getIterator()->willReturn(new \ArrayIterator([$orderItem->getWrappedObject()]));
$orderItem->getQuantity()->willReturn(2);
$orderItem->getVariant()->willReturn($productVariant);
$taxRateResolver->resolve($productVariant, ['zone' => $zone])->willReturn($taxRate);
$orderItem->getUnits()->willReturn($units);
$units->getIterator()->willReturn(new \ArrayIterator([$unit1->getWrappedObject(), $unit2->getWrappedObject()]));
$unit1->getTotal()->willReturn(1000);
$calculator->calculate(1000, $taxRate)->willReturn(0);
$unit2->getTotal()->willReturn(900);
$calculator->calculate(900, $taxRate)->willReturn(0);
$adjustmentsFactory->createWithData(AdjustmentInterface::TAX_ADJUSTMENT, Argument::cetera())->shouldNotBeCalled();
$unit1->addAdjustment(Argument::any())->shouldNotBeCalled();
$unit2->addAdjustment(Argument::any())->shouldNotBeCalled();
$this->apply($order, $zone);
}
示例6: ArrayCollection
function it_does_not_distribute_0_amount_to_unit_even_if_its_middle_element(AdjustmentFactoryInterface $adjustmentFactory, AdjustmentInterface $adjustment, IntegerDistributorInterface $distributor, OrderInterface $order, OrderItemInterface $coltItem, OrderItemUnitInterface $firstColtUnit, OrderItemUnitInterface $secondColtUnit, PromotionInterface $promotion)
{
$order->countItems()->willReturn(1);
$order->getItems()->willReturn(new ArrayCollection([$coltItem->getWrappedObject()]));
$coltItem->getQuantity()->willReturn(2);
$distributor->distribute(1, 2)->willReturn([1, 0]);
$coltItem->getUnits()->willReturn(new ArrayCollection([$firstColtUnit->getWrappedObject(), $secondColtUnit->getWrappedObject()]));
$promotion->getName()->willReturn('Winter guns promotion!');
$promotion->getCode()->willReturn('WINTER_GUNS_PROMOTION');
$adjustmentFactory->createWithData(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT, 'Winter guns promotion!', 1)->willReturn($adjustment);
$adjustment->setOriginCode('WINTER_GUNS_PROMOTION')->shouldBeCalled();
$firstColtUnit->addAdjustment($adjustment)->shouldBeCalled();
$secondColtUnit->addAdjustment(Argument::any())->shouldNotBeCalled();
$this->apply($order, $promotion, [1]);
}
示例7: 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);
}
示例8:
function it_revert_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, ['amount' => 1000], $promotion);
}
示例9: ArrayCollection
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);
}