Inheritance: extends AbstractFactory
 function it_cancels_unpaid_orders(Factory $stateMachineFactory, OrderInterface $firstOrder, OrderInterface $secondOrder, OrderRepositoryInterface $orderRepository, StateMachineInterface $firstOrderStateMachine, StateMachineInterface $secondOrderStateMachine)
 {
     $orderRepository->findOrdersUnpaidSince(Argument::type(\DateTime::class))->willReturn([$firstOrder, $secondOrder]);
     $stateMachineFactory->get($firstOrder, 'sylius_order')->willReturn($firstOrderStateMachine);
     $stateMachineFactory->get($secondOrder, 'sylius_order')->willReturn($secondOrderStateMachine);
     $firstOrderStateMachine->apply(OrderTransitions::TRANSITION_CANCEL)->shouldBeCalled();
     $secondOrderStateMachine->apply(OrderTransitions::TRANSITION_CANCEL)->shouldBeCalled();
     $this->cancel();
 }
 /**
  * Get all of posible transitions.
  *
  * @param StatableInterface $object
  * @param string $objectIdentifier
  *
  * @return array|null
  *
  * @throws \SM\SMException
  */
 public function getPosibleTransitions(StatableInterface $object = null, $objectIdentifier = 'id')
 {
     if (empty($object)) {
         return;
     }
     $sm = $this->factory->get($object, $object->getStateGraph());
     if (empty($sm)) {
         return;
     }
     $tasks = array();
     $accessor = PropertyAccess::createPropertyAccessor();
     foreach ($object->getStateTransitions() as $transition) {
         if ($sm->can($transition)) {
             $color = $this->getTransitionColor($transition);
             $tasks[] = array('id' => $accessor->getValue($object, $objectIdentifier), 'name' => $transition, 'color' => $color, 'graph' => $object->getStateGraph(), 'label' => $this->getTransition($transition), 'negative' => $this->isNegativeColor($color, 'transition'), 'positive' => $this->isPositiveColor($color, 'transition'));
         }
     }
     return empty($tasks) ? null : $tasks;
 }
 /**
  * @param OrderInterface $expiredUnpaidOrder
  */
 private function cancelOrder(OrderInterface $expiredUnpaidOrder)
 {
     $stateMachine = $this->stateMachineFactory->get($expiredUnpaidOrder, OrderTransitions::GRAPH);
     $stateMachine->apply(OrderTransitions::TRANSITION_CANCEL);
 }