Example #1
0
 /**
  * @expectedException \Oro\Bundle\WorkflowBundle\Exception\WorkflowException
  * @expectedExceptionMessage Can't find workflow by given identifier.
  */
 public function testGetWorkflowCantFind()
 {
     $incorrectIdentifier = null;
     $this->workflowManager->getWorkflow($incorrectIdentifier);
 }
Example #2
0
 /**
  * @param WorkflowManager $workflowManager
  * @param WorkflowItem    $workflowItem
  * @param string          $transition
  * @param array           $data
  */
 protected function transit($workflowManager, $workflowItem, $transition, array $data)
 {
     foreach ($data as $key => $value) {
         $workflowItem->getData()->set($key, $value);
     }
     $workflow = $workflowManager->getWorkflow($workflowItem);
     /** @var EntityManager $em */
     $workflow->transit($workflowItem, $transition);
     $workflowItem->setUpdated();
 }
 /**
  * @param WorkflowItem $workflowItem
  * @param string $transition
  * @return bool
  */
 protected function isTransitionAllowed(WorkflowItem $workflowItem, $transition)
 {
     $workflow = $this->workflowManager->getWorkflow($workflowItem);
     return $workflow->isTransitionAllowed($workflowItem, $transition);
 }