public function testConstructSuccess()
 {
     $this->specify('Workflow factory construct fails if classMap is not an array', function () {
         $factory = new ArrayWorkflowItemFactory(['workflowSourceNamespace' => 'a\\b\\c', 'classMap' => [ArrayWorkflowItemFactory::CLASS_MAP_WORKFLOW => 'my\\namespace\\Workflow', ArrayWorkflowItemFactory::CLASS_MAP_STATUS => 'my\\namespace\\Status', ArrayWorkflowItemFactory::CLASS_MAP_TRANSITION => 'my\\namespace\\Transition']]);
         expect($factory->getClassMapByType(ArrayWorkflowItemFactory::CLASS_MAP_WORKFLOW))->equals('my\\namespace\\Workflow');
         expect($factory->getClassMapByType(ArrayWorkflowItemFactory::CLASS_MAP_STATUS))->equals('my\\namespace\\Status');
         expect($factory->getClassMapByType(ArrayWorkflowItemFactory::CLASS_MAP_TRANSITION))->equals('my\\namespace\\Transition');
     });
 }
Ejemplo n.º 2
0
 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');
     });
 }