public function testWorkflowCached() { $this->factory->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A']]); $this->specify('workflow are loaded once', function () { verify('workflow instances are the same', spl_object_hash($this->factory->getWorkflow('wid', null)))->equals(spl_object_hash($this->factory->getWorkflow('wid', null))); }); }
public function testFailToLoadWorkflowSourceClass() { $this->specify('incorrect status id format', function () { $this->factory->getStatus('id', null, null); }, ['throws' => 'fproject\\workflow\\core\\WorkflowException']); $this->specify('empty provider fails to load workflow from non-existant workflow class', function () { $this->factory->getWorkflow('id', null); }, ['throws' => 'fproject\\workflow\\core\\WorkflowException']); $this->specify('empty provider fails to load status from non-existant workflow class', function () { $this->factory->getStatus('w/s', null, null); }, ['throws' => 'fproject\\workflow\\core\\WorkflowException']); $this->specify('empty provider fails to load transition from non-existant workflow class', function () { $this->factory->getTransitions('w/s', null, null); }, ['throws' => 'fproject\\workflow\\core\\WorkflowException']); }