Ejemplo n.º 1
0
 public function testGetWorkflowName()
 {
     $builder = new WorkflowBuilder('test');
     $this->assertEquals('test', $builder->getWorkflowName());
     $builder = new WorkflowBuilder(' ', 'null');
     $this->assertEquals(' ', $builder->getWorkflowName());
 }
Ejemplo n.º 2
0
 /**
  * Get a workflow by its name
  *
  * @param  string $name Name that the workflow is referenced by
  *
  * @return AbstractWorkflow Workflow with the given if exists
  */
 public function getWorkflow($name)
 {
     // First check if the workflow is in the the built list
     if (array_key_exists($name, $this->workflows)) {
         return $this->workflows[$name];
     } elseif (array_key_exists($name, $this->workflowDefinitions)) {
         // If not check if the definition is in the list, and build it if it is
         $builder = new WorkflowBuilder($this->workflowDefinitions[$name]->getName());
         $builder->contextClass($this->workflowDefinitions[$name]->getContextClass());
         $builder = $this->workflowDefinitions[$name]->build($builder);
         $this->workflows[$name] = $builder->build();
         return $this->workflows[$name];
     } else {
         // If not that either, throw error
         throw new WorkflowNotFoundException($name, array_keys($this->workflowDefinitions));
     }
 }