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


PHP OrderItemInterface::getProduct方法代码示例

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


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

示例1:

 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

示例2:

 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

示例3:

 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

示例4:

 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

示例5:

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

示例6:

 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

示例7:

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


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