コード例 #1
0
 public function testLoadWorkflowSuccess2()
 {
     $factory = new ArrayWorkflowItemFactory();
     $factory->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A' => ['label' => 'Entry', 'transition' => 'A,B'], 'B' => ['label' => 'Published', 'transition' => '  A  , B  ']]]);
     verify($factory->getStatus('wid/A', null, null))->notNull();
     verify($factory->getStatus('wid/B', null, null))->notNull();
     verify(count($factory->getTransitions('wid/A', null, null)))->equals(2);
 }
コード例 #2
0
ファイル: StatusTest.php プロジェクト: fproject/workflowii
 public function testStatusCached()
 {
     $this->factory->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A' => []]]);
     $this->specify('status are loaded once', function () {
         $this->factory->getWorkflow('wid', null);
         verify('status instances are the same', spl_object_hash($this->factory->getStatus('wid/A', null, null)))->equals(spl_object_hash($this->factory->getStatus('wid/A', null, null)));
     });
 }
コード例 #3
0
ファイル: ClassMapTest.php プロジェクト: fproject/workflowii
 public function testClassMapStatus()
 {
     $this->specify('Replace default status class with custom one', function () {
         $factory = new ArrayWorkflowItemFactory(['workflowSourceNamespace' => 'tests\\codeception\\unit\\models', 'classMap' => [ArrayWorkflowItemFactory::CLASS_MAP_STATUS => 'tests\\codeception\\unit\\models\\MyStatus']]);
         verify($factory->getClassMapByType(ArrayWorkflowItemFactory::CLASS_MAP_WORKFLOW))->equals('fproject\\workflow\\core\\Workflow');
         verify($factory->getClassMapByType(ArrayWorkflowItemFactory::CLASS_MAP_STATUS))->equals('tests\\codeception\\unit\\models\\MyStatus');
         verify($factory->getClassMapByType(ArrayWorkflowItemFactory::CLASS_MAP_TRANSITION))->equals('fproject\\workflow\\core\\Transition');
         $status = $factory->getStatus('Item04Workflow/A', null, null);
         expect(get_class($status))->equals('tests\\codeception\\unit\\models\\MyStatus');
     });
 }
コード例 #4
0
 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']);
 }