Ejemplo n.º 1
0
 /**
  * @param WorkflowStep $step
  * @return WorkflowDefinition
  */
 public function removeStep(WorkflowStep $step)
 {
     $stepName = $step->getName();
     if ($this->hasStepByName($stepName)) {
         $step = $this->getStepByName($stepName);
         $this->steps->removeElement($step);
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * @param WorkflowStep $workflowStep
  * @return WorkflowStep
  */
 public function import(WorkflowStep $workflowStep)
 {
     $this->setName($workflowStep->getName())->setLabel($workflowStep->getLabel())->setStepOrder($workflowStep->getStepOrder())->setFinal($workflowStep->isFinal());
     return $this;
 }
Ejemplo n.º 3
0
 public function testGetAllowedTransitions()
 {
     $firstTransition = new Transition();
     $firstTransition->setName('first_transition');
     $secondTransition = new Transition();
     $secondTransition->setName('second_transition');
     $workflowStep = new WorkflowStep();
     $workflowStep->setName('test_step');
     $step = new Step();
     $step->setName($workflowStep->getName());
     $step->setAllowedTransitions(array($secondTransition->getName()));
     $workflow = $this->createWorkflow();
     $workflow->getStepManager()->setSteps(array($step));
     $workflow->getTransitionManager()->setTransitions(array($firstTransition, $secondTransition));
     $workflowItem = new WorkflowItem();
     $workflowItem->setCurrentStep($workflowStep);
     $actualTransitions = $workflow->getTransitionsByWorkflowItem($workflowItem);
     $this->assertEquals(array($secondTransition), $actualTransitions->getValues());
 }