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


PHP OrderInterface::isEmpty方法代码示例

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


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

示例1:

 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

示例2:

 function it_adds_new_item_units_to_existing_shipment(OrderInterface $order, ShipmentInterface $shipment, Collection $shipments, OrderItemUnitInterface $itemUnit, OrderItemUnitInterface $itemUnitWithoutShipment)
 {
     $shipments->first()->willReturn($shipment);
     $order->isEmpty()->willReturn(false);
     $order->hasShipments()->willReturn(true);
     $order->getItemUnits()->willReturn([$itemUnit, $itemUnitWithoutShipment]);
     $order->getShipments()->willReturn($shipments);
     $itemUnit->getShipment()->willReturn($shipment);
     $shipment->addUnit($itemUnitWithoutShipment)->shouldBeCalled();
     $shipment->addUnit($itemUnit)->shouldNotBeCalled();
     $this->process($order);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:12,代码来源:OrderShipmentProcessorSpec.php

示例3: process

 /**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order)
 {
     if ($order->isEmpty()) {
         $order->removeShipments();
         return;
     }
     $shipment = $this->getOrderShipment($order);
     if (null === $shipment) {
         return;
     }
     foreach ($order->getItemUnits() as $itemUnit) {
         if (null === $itemUnit->getShipment()) {
             $shipment->addUnit($itemUnit);
         }
     }
 }
开发者ID:origammi,项目名称:Sylius,代码行数:19,代码来源:OrderShipmentProcessor.php

示例4:

 function it_does_not_apply_taxes_if_there_is_no_tax_zone($defaultTaxZoneProvider, $zoneMatcher, $orderItemsTaxesApplicator, AddressInterface $address, \Iterator $iterator, Collection $items, OrderInterface $order, OrderItemInterface $orderItem)
 {
     $order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getItems()->willReturn($items);
     $order->isEmpty()->willReturn(false);
     $items->count()->willReturn(1);
     $items->getIterator()->willReturn($iterator);
     $iterator->rewind()->shouldBeCalled();
     $iterator->valid()->willReturn(true, false)->shouldBeCalled();
     $iterator->current()->willReturn($orderItem);
     $iterator->next()->shouldBeCalled();
     $orderItem->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getShippingAddress()->willReturn($address);
     $zoneMatcher->match($address)->willReturn(null);
     $defaultTaxZoneProvider->getZone()->willReturn(null);
     $orderItemsTaxesApplicator->apply(Argument::any())->shouldNotBeCalled();
     $this->apply($order);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:18,代码来源:OrderTaxesApplicatorSpec.php

示例5: addressingAction

 public function addressingAction(Request $request, OrderInterface $order)
 {
     if ($order->isEmpty()) {
         return new Response('Order cannot be empty!', 400);
     }
     if ($request->isMethod('GET')) {
         return new Response('Method not allowed!', 405);
     }
     $this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_INITIALIZE, $order);
     $form = $this->createCheckoutAddressingForm($order);
     if ($form->submit($request)->isValid()) {
         $this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_PRE_COMPLETE, $order);
         $stateMachine = $this->get('sm.factory')->get($order, OrderCheckoutTransitions::GRAPH);
         $stateMachine->apply(OrderCheckoutTransitions::SYLIUS_ADDRESSING);
         $this->getManager()->persist($order);
         $this->getManager()->flush();
         $this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_COMPLETE, $order);
         return $this->handleView($this->view($order));
     }
     return $this->handleView($this->view($form, 400));
 }
开发者ID:Spomky,项目名称:Sylius,代码行数:21,代码来源:CheckoutController.php

示例6:

 function it_does_not_process_taxes_if_there_is_no_tax_zone(ZoneProviderInterface $defaultTaxZoneProvider, ZoneMatcherInterface $zoneMatcher, AddressInterface $address, \Iterator $itemsIterator, Collection $items, OrderInterface $order, OrderItemInterface $orderItem, PrioritizedServiceRegistryInterface $strategyRegistry)
 {
     $order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getItems()->willReturn($items);
     $order->isEmpty()->willReturn(false);
     $items->count()->willReturn(1);
     $items->getIterator()->willReturn($itemsIterator);
     $itemsIterator->rewind()->shouldBeCalled();
     $itemsIterator->valid()->willReturn(true, false)->shouldBeCalled();
     $itemsIterator->current()->willReturn($orderItem);
     $itemsIterator->next()->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:TeamNovatek,项目名称:Sylius,代码行数:18,代码来源:OrderTaxesProcessorSpec.php


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