public function testCurrentStepName()
 {
     $this->assertNull($this->workflowItem->getCurrentStepName());
     $value = 'foo';
     $this->workflowItem->setCurrentStepName($value);
     $this->assertEquals($value, $this->workflowItem->getCurrentStepName());
 }
Ejemplo n.º 2
0
 /**
  * Get transitions for existing workflow item.
  *
  * @param WorkflowItem $workflowItem
  * @return Collection|Transition[]
  * @throws UnknownStepException
  */
 public function getTransitionsByWorkflowItem(WorkflowItem $workflowItem)
 {
     $currentStepName = $workflowItem->getCurrentStepName();
     $currentStep = $this->stepManager->getStep($currentStepName);
     if (!$currentStep) {
         throw new UnknownStepException($currentStepName);
     }
     $transitions = new ArrayCollection();
     $transitionNames = $currentStep->getAllowedTransitions();
     foreach ($transitionNames as $transitionName) {
         $transition = $this->transitionManager->extractTransition($transitionName);
         $transitions->add($transition);
     }
     return $transitions;
 }