Example #1
0
 /**
  * Use generator to add a proper number to order.
  *
  * @param GenericEvent $event
  */
 public function generateOrderNumber(GenericEvent $event)
 {
     $order = $event->getSubject();
     if (null !== $order->getNumber()) {
         return;
     }
     $this->listener->enableEntity($order);
 }
 function it_generates_order_number(NumberListener $listener, GenericEvent $event, OrderInterface $order)
 {
     $event->getSubject()->willReturn($order);
     $order->getNumber()->willReturn(null);
     $listener->enableEntity($order)->shouldBeCalled();
     $this->generateOrderNumber($event);
 }