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


PHP Model\OrderItemInterface类代码示例

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


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

示例1:

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

示例2:

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

示例3:

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

示例4:

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

示例5:

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

示例6:

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

示例7:

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

示例8:

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

示例9:

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

示例10: isItemEligible

 /**
  * @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;
 }
开发者ID:stevedien,项目名称:Sylius,代码行数:16,代码来源:ContainsProductRuleChecker.php

示例11:

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

示例12: setUnitsAdjustments

 /**
  * @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++;
     }
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:16,代码来源:ItemPercentageDiscountAction.php

示例13:

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

示例14: applyAdjustmentsOnItemUnits

 /**
  * @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);
     }
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:17,代码来源:UnitsPromotionAdjustmentsApplicator.php

示例15:

 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


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