Beispiel #1
0
 public function getSavedConfigurationSettings()
 {
     $savedConfigurationSettingArray = array();
     $attendanceService = new AttendanceService();
     $recordExists1 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_INITIAL, ConfigureForm::ESS_USER, PluginWorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_TIME, PluginAttendanceRecord::STATE_INITIAL);
     $recordExists2 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_IN, ConfigureForm::ESS_USER, PluginWorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_TIME, PluginAttendanceRecord::STATE_PUNCHED_IN);
     $recordExists3 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_IN, ConfigureForm::ESS_USER, PluginWorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_IN_TIME, PluginAttendanceRecord::STATE_PUNCHED_IN);
     $recordExists4 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_OUT, ConfigureForm::ESS_USER, PluginWorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_OUT_TIME, PluginAttendanceRecord::STATE_PUNCHED_OUT);
     $recordExists13 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_OUT, ConfigureForm::ESS_USER, PluginWorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_IN_TIME, PluginAttendanceRecord::STATE_PUNCHED_OUT);
     $recordExists5 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_IN, ConfigureForm::ESS_USER, PluginWorkflowStateMachine::ATTENDANCE_ACTION_DELETE, PluginAttendanceRecord::STATE_NA);
     $recordExists6 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_OUT, ConfigureForm::ESS_USER, PluginWorkflowStateMachine::ATTENDANCE_ACTION_DELETE, PluginAttendanceRecord::STATE_NA);
     $recordExists7 = $attendanceService->getSavedConfiguration(WorkflowStateMachine::FLOW_ATTENDANCE, AttendanceRecord::STATE_PUNCHED_IN, ConfigureForm::SUPERVISOR, WorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_IN_TIME, AttendanceRecord::STATE_PUNCHED_IN);
     $recordExists8 = $attendanceService->getSavedConfiguration(WorkflowStateMachine::FLOW_ATTENDANCE, AttendanceRecord::STATE_PUNCHED_OUT, ConfigureForm::SUPERVISOR, WorkflowStateMachine::ATTENDANCE_ACTION_EDIT_PUNCH_OUT_TIME, AttendanceRecord::STATE_PUNCHED_OUT);
     $recordExists9 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_IN, ConfigureForm::SUPERVISOR, PluginWorkflowStateMachine::ATTENDANCE_ACTION_DELETE, PluginAttendanceRecord::STATE_NA);
     $recordExists10 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_OUT, ConfigureForm::SUPERVISOR, PluginWorkflowStateMachine::ATTENDANCE_ACTION_DELETE, PluginAttendanceRecord::STATE_NA);
     $recordExists11 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_INITIAL, ConfigureForm::SUPERVISOR, PluginWorkflowStateMachine::ATTENDANCE_ACTION_PROXY_PUNCH_IN, PluginAttendanceRecord::STATE_PUNCHED_IN);
     $recordExists12 = $attendanceService->getSavedConfiguration(PluginWorkflowStateMachine::FLOW_ATTENDANCE, PluginAttendanceRecord::STATE_PUNCHED_IN, ConfigureForm::SUPERVISOR, PluginWorkflowStateMachine::ATTENDANCE_ACTION_PROXY_PUNCH_OUT, PluginAttendanceRecord::STATE_PUNCHED_OUT);
     if ($recordExists1 || $recordExists2) {
         $savedConfigurationSettingArray['configuration1'] = true;
     } else {
         $savedConfigurationSettingArray['configuration1'] = false;
     }
     if ($recordExists3 || $recordExists4 || $recordExists5 || $recordExists6 || $recordExists13) {
         $savedConfigurationSettingArray['configuration2'] = true;
     } else {
         $savedConfigurationSettingArray['configuration2'] = false;
     }
     if ($recordExists7 || $recordExists8 || $recordExists9 || $recordExists10 || $recordExists11 || $recordExists12) {
         $savedConfigurationSettingArray['configuration3'] = true;
     } else {
         $savedConfigurationSettingArray['configuration3'] = false;
     }
     return $savedConfigurationSettingArray;
 }
 /**
  * @group orangehrmAttendancePlugin
  */
 public function testSearchAttendanceRecords()
 {
     $attendanceDaoMock = $this->getMock('AttendanceDao', array('searchAttendanceRecords'));
     $attendanceDaoMock->expects($this->once())->method('searchAttendanceRecords')->with($attendanceRecordId)->will($this->returnValue(array("id" => 1)));
     $attendanceService = new AttendanceService();
     $attendanceService->setAttendanceDao($attendanceDaoMock);
     $this->assertEquals(1, sizeof($attendanceService->searchAttendanceRecords()));
 }