protected function setUp() { TestDataService::truncateSpecificTables(array('Employee', 'Leave', 'LeaveRequest', 'LeaveType', 'EmployeeLeaveEntitlement', 'LeavePeriod')); // Save leave type $leaveTypeData = sfYaml::load(sfConfig::get('sf_plugins_dir') . '/orangehrmCoreLeavePlugin/test/fixtures/leaveType.yml'); $leaveTypeDao = new LeaveTypeDao(); $leaveType = new LeaveType(); $leaveType->setLeaveTypeName($leaveTypeData['leaveType']['LT_001']['name']); // $leaveType->setLeaveRules($leaveTypeData['leaveType']['LT_001']['rule']); $leaveTypeDao->saveLeaveType($leaveType); $this->leaveType = $leaveType; $this->leaveTypeId = $leaveType->getLeaveTypeId(); // Save leave Period $leavePeriodData = sfYaml::load(sfConfig::get('sf_plugins_dir') . '/orangehrmCoreLeavePlugin/test/fixtures/leavePeriod.yml'); $leavePeriodService = new LeavePeriodService(); $leavePeriodService->setLeavePeriodDao(new LeavePeriodDao()); $leavePeriod = new LeavePeriod(); $leavePeriod->setStartDate($leavePeriodData['leavePeriod']['1']['startDate']); $leavePeriod->setEndDate($leavePeriodData['leavePeriod']['1']['endDate']); $leavePeriodService->saveLeavePeriod($leavePeriod); $this->leavePeriod = $leavePeriod; $this->leavePeriodId = $leavePeriod->getLeavePeriodId(); // Save Employee $employeeservice = new EmployeeService(); $this->employee = new Employee(); $employeeservice->saveEmployee($this->employee); $this->empNumber = $this->employee->getEmpNumber(); // save leave quota $this->leaveEntitlement = sfYaml::load(sfConfig::get('sf_plugins_dir') . '/orangehrmCoreLeavePlugin/test/fixtures/leaveEntitlement.yml'); $this->leaveEntitlementDao = new LeaveEntitlementDao(); }
public function testGetLeaveTypeListForOperationalCountry() { $leaveTypeList = $this->dao->getLeaveTypeList(1); $this->assertEquals(2, count($leaveTypeList)); $this->assertEquals(4, $leaveTypeList[0]->getId()); $this->assertEquals(2, $leaveTypeList[1]->getId()); $leaveTypeList = $this->dao->getLeaveTypeList(2); $this->assertEquals(0, count($leaveTypeList)); }