コード例 #1
0
 function it_does_nothing_if_tax_rate_cannot_be_resolved(CalculatorInterface $calculator, TaxRateResolverInterface $taxRateResolver, OrderInterface $order, ShipmentInterface $shipment, ShippingMethodInterface $shippingMethod, ZoneInterface $zone)
 {
     $order->getShippingTotal()->willReturn(100);
     $order->getShipments()->willReturn(new ArrayCollection([$shipment->getWrappedObject()]));
     $shipment->getMethod()->willReturn($shippingMethod);
     $taxRateResolver->resolve($shippingMethod, ['zone' => $zone])->willReturn(null);
     $calculator->calculate(Argument::any())->shouldNotBeCalled();
     $order->addAdjustment(Argument::any())->shouldNotBeCalled();
     $this->apply($order, $zone);
 }
コード例 #2
0
 function it_does_not_mark_an_order_if_it_is_already_in_this_shipping_state(FactoryInterface $stateMachineFactory, OrderInterface $order, ShipmentInterface $shipment1, ShipmentInterface $shipment2, StateMachineInterface $orderStateMachine)
 {
     $shipments = new ArrayCollection();
     $shipments->add($shipment1->getWrappedObject());
     $shipments->add($shipment2->getWrappedObject());
     $order->getShipments()->willReturn($shipments);
     $order->getShippingState()->willReturn(OrderShippingStates::STATE_SHIPPED);
     $stateMachineFactory->get($order, OrderShippingTransitions::GRAPH)->willReturn($orderStateMachine);
     $shipment1->getState()->willReturn(ShipmentInterface::STATE_SHIPPED);
     $shipment2->getState()->willReturn(ShipmentInterface::STATE_SHIPPED);
     $orderStateMachine->apply(OrderShippingTransitions::TRANSITION_SHIP)->shouldNotBeCalled();
     $this->resolve($order);
 }