Returns the Workflow instance whose id is passed as argument.
public getWorkflow ( $id ) : |
||
return | The workflow instance or NULL if no workflow could be found |
public function testLoadMinimalWorkflowSuccess() { $src = new WorkflowFileSource(); $src->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A']]); $this->specify('can load workflow', function () use($src) { $w = $src->getWorkflow('wid'); verify('a Workflow instance is returned', get_class($w))->equals('raoul2000\\workflow\\base\\Workflow'); verify('workflow id is consistent', $w->getId())->equals('wid'); }); }
public function testWorkflowAccessorSuccess() { $src = new WorkflowFileSource(); $src->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A' => ['label' => 'label A', 'transition' => ['B', 'C']], 'B' => [], 'C' => []]]); $w = $src->getWorkflow('wid'); verify_that($w != null); $this->specify('initial status can be obtained through workflow', function () use($w) { expect_that($w->getInitialStatus() instanceof StatusInterface); expect_that($w->getInitialStatus()->getId() == $w->getInitialStatusId()); }); }