Exemplo n.º 1
0
 function it_calls_taxation_processor_on_order(TaxationProcessorInterface $taxationProcessor, GenericEvent $event, OrderInterface $order)
 {
     $event->getSubject()->willReturn($order);
     $taxationProcessor->applyTaxes($order)->shouldBeCalled();
     $order->calculateTotal()->shouldBeCalled();
     $this->applyTaxes($event);
 }
Exemplo n.º 2
0
 /**
  * @param GenericEvent $event
  *
  * @throws UnexpectedTypeException
  */
 public function applyTaxes(GenericEvent $event)
 {
     $order = $event->getSubject();
     if (!$order instanceof OrderInterface) {
         throw new UnexpectedTypeException($order, OrderInterface::class);
     }
     $this->taxationProcessor->applyTaxes($order);
 }
Exemplo n.º 3
0
 /**
  * Get the order from event and run the taxation processor on it.
  *
  * @param GenericEvent $event
  *
  * @throws UnexpectedTypeException
  */
 public function applyTaxes(GenericEvent $event)
 {
     $order = $event->getSubject();
     if (!$order instanceof OrderInterface) {
         throw new UnexpectedTypeException($order, 'Sylius\\Component\\Core\\Model\\OrderInterface');
     }
     $this->taxationProcessor->applyTaxes($order);
     $order->calculateTotal();
 }