public function testSaveWorkflowStateMachineRecord() { $workflowStateMachineRecord = new WorkflowStateMachine(); $workflowStateMachineRecord->setAction(PluginWorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_TIME); $workflowStateMachineRecord->setState(PluginAttendanceRecord::STATE_CREATED); $workflowStateMachineRecord->setResultingState(PluginAttendanceRecord::STATE_CREATED); $workflowStateMachineRecord->setWorkflow(PluginWorkflowStateMachine::FLOW_ATTENDANCE); $workflowStateMachineRecord->setRole("ESS USER"); $this->accessFlowStateMachineDao->saveWorkflowStateMachineRecord($workflowStateMachineRecord); $this->assertNotNull($workflowStateMachineRecord->getId()); $this->assertEquals($workflowStateMachineRecord->getAction(), PluginWorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_TIME); $this->assertEquals($workflowStateMachineRecord->getState(), PluginAttendanceRecord::STATE_CREATED); }
public function testListenOneWorkflow() { $workFlow = new WorkflowStateMachine(); $workFlow->setAction('apply'); $workFlow->setRolesToNotify('ESS,Supervisor,ABC'); $workFlow->setRole('ess'); $eventData = array('workFlow' => $workFlow); $emailType = 'leave.apply'; $recipientRoles = array('ESS', 'Supervisor', 'ABC'); $mockService = $this->getMock('EmailService', array('sendEmailNotifications')); $mockService->expects($this->once())->method('sendEmailNotifications')->with($emailType, $recipientRoles, $eventData, 'ess'); $this->mailer->setEmailService($mockService); $sfEvent = new sfEvent($this, 'test', $eventData); $this->mailer->listen($sfEvent); }
public function saveConfigurartion($flow, $state, $role, $action, $resultingState) { $workflowStateMachineRecord = new WorkflowStateMachine(); $workflowStateMachineRecord->setWorkflow($flow); $workflowStateMachineRecord->setState($state); $workflowStateMachineRecord->setRole($role); $workflowStateMachineRecord->setAction($action); $workflowStateMachineRecord->setResultingState($resultingState); $this->getAccessFlowStateMachineService()->saveWorkflowStateMachineRecord($workflowStateMachineRecord); }