protected function setUp()
 {
     TestDataService::truncateSpecificTables(array('Employee', 'LeaveType'));
     // 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->addEmployee($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 testCallGetLocationListMethod()
 {
     TestDataService::populate($this->locationFixture);
     $paramObj = new WSRequestParameters();
     $paramObj->setAppId(1);
     $paramObj->setAppToken('1234567890');
     $paramObj->setMethod('getLocationList');
     $paramObj->setSessionToken(uniqid('ohrm_ws_session_'));
     $paramObj->setParameters(array(0));
     $paramObj->setRequestMethod('GET');
     $mock = $this->getMock('AdminWebServiceHelper', array('getAccessibleLocations'));
     $mock->method('getAccessibleLocations')->will($this->returnValue(array()));
     $this->adminWebServiceWrapper->setServiceInstance($mock);
     $paramObj->setWrapperObject($this->adminWebServiceWrapper);
     $result = $this->manager->callMethod($paramObj);
     $this->assertNotNull($result);
     foreach ($this->locationTestCases['Location'] as $key => $testCase) {
         $this->assertEquals($result[$key]['id'], $testCase['id']);
         $this->assertEquals($result[$key]['locationName'], $testCase['name']);
         $this->assertEquals($result[$key]['country_code'], $testCase['country_code']);
         $this->assertEquals($result[$key]['province'], $testCase['province']);
         $this->assertEquals($result[$key]['city'], $testCase['city']);
         $this->assertEquals($result[$key]['address'], $testCase['address']);
     }
 }
 public function testSanitizeNotificationSection()
 {
     $notifications = TestDataService::loadObjectList('BeaconNotification', $this->fixture, 'BeaconNotification');
     $notificationXML = new SimpleXMLElement($notifications[0]->getDefinition());
     $sanitizedBody = $this->beaconNotificationService->sanitizeNotificationSection($notificationXML->content->body . "");
     $this->assertTrue(substr_count($sanitizedBody, '<script>') == 0);
 }
示例#4
0
 /**
  * Set up method
  */
 protected function setUp()
 {
     $this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmCorePlugin/test/fixtures/MenuDao.yml';
     TestDataService::populate($this->fixture);
     $this->menuService = new MenuService();
     $this->_clearDoctrineResults();
 }
 public function testCalculateDaysInTheTimesheetPeriod()
 {
     $key = 'timesheet_period_and_start_date';
     $xmlString = TestDataService::getRecords("SELECT value from hs_hr_config WHERE `key` = '" . $key . "'");
     $xmlString = $xmlString[0]['value'];
     $xmlString = simplexml_load_String($xmlString);
     $currentDate = '2011-04-24';
     // This is necessary to make timeStampDiff 0 in MonthlyTimesheetPeriod::getDatesOfTheTimesheetPeriod
     // $timeStampDiff = $clientTimeZoneOffset * 3600 - $serverTimezoneOffset;
     $serverTimezoneOffset = (int) date('Z');
     sfContext::getInstance()->getUser()->setAttribute('system.timeZoneOffset', $serverTimezoneOffset / 3600);
     $datesArray = $this->weeklyTimesheetPeriod->calculateDaysInTheTimesheetPeriod($currentDate, $xmlString);
     $this->assertEquals($datesArray[0], "2011-04-18 00:00");
     $this->assertEquals($datesArray[3], "2011-04-21 00:00");
     $this->assertEquals(end($datesArray), "2011-04-24 00:00");
     $currentDate = '2012-02-28';
     $datesArray = $this->weeklyTimesheetPeriod->calculateDaysInTheTimesheetPeriod($currentDate, $xmlString);
     $this->assertEquals($datesArray[0], "2012-02-27 00:00");
     $this->assertEquals($datesArray[3], "2012-03-01 00:00");
     $this->assertEquals(end($datesArray), "2012-03-04 00:00");
     $currentDate = '2011-12-29';
     $datesArray = $this->weeklyTimesheetPeriod->calculateDaysInTheTimesheetPeriod($currentDate, $xmlString);
     $this->assertEquals($datesArray[0], "2011-12-26 00:00");
     $this->assertEquals($datesArray[3], "2011-12-29 00:00");
     $this->assertEquals(end($datesArray), "2012-01-01 00:00");
 }
 public function testCallGetCorporateDirectoryEmployeeDetailsMethod()
 {
     TestDataService::populate($this->fixture);
     $employeeService = new EmployeeService();
     $empPicture = $employeeService->getEmployeePicture(2);
     $base64TestStringForEmp1 = 'R0lGODlhCgAKALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//////ywAAAAACgAKAAAEClDJSau9OOvNe44AOw==';
     $decodedBase64String = base64_decode($base64TestStringForEmp1);
     $empPicture->setPicture($decodedBase64String);
     $empPicture->save();
     $empPicture = $employeeService->getEmployeePicture(3);
     $base64TestStringForEmp2 = '/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAHcAdwMBEQACEQEDEQH/xAAbAAEBAQEAAwEAAAAAAAAA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SFOL3vaNIXVgmejzTb7LjLyAttxJStJ5lA7CKD2AATqgYAGMCgmVb4qnFuFrulnKiFEZPuNaReriPj5bRiLkRERP8g5OieLO8V967n3OOjv2bvH8g5OieLO8V96Z9zjofZu8fyDk6J4s7xX3pn3OOh9m7x/IOTonizvFfemfc46H2bvH8g5OieLO8V96Z9zjofZu8fyDk6J4s7xX3pn3OOh9m7x/IOTonizvFfemfc46H2bvH8g5OieLO8V96Z9zjofZu8fyDk6J4s7xX3pn3OOh9m7x/IeOTYni1bxX3pn3OOh9i5x/IfdhluO0lplAQ2nmSKzqqmqfmWVddVdX/qqfmX//2Q==';
     $decodedBase64String = base64_decode($base64TestStringForEmp2);
     $empPicture->setPicture($decodedBase64String);
     $empPicture->save();
     $paramObj = new WSRequestParameters();
     $paramObj->setAppId(1);
     $paramObj->setAppToken('1234567890');
     $paramObj->setMethod('getCorporateDirectoryEmployeeDetails');
     $paramObj->setSessionToken(uniqid('ohrm_ws_session_'));
     $paramObj->setParameters(array('includeTerminate' => 0));
     $paramObj->setRequestMethod('GET');
     $result = $this->manager->callMethod($paramObj);
     $this->assertNotNull($result);
     $this->assertEquals(6, count($result));
     $expectedEmployeeList = $this->getExpectedEmployeeList($base64TestStringForEmp1, $base64TestStringForEmp2);
     foreach ($expectedEmployeeList as $key => $testCase) {
         $this->assertEquals($result[$key], $expectedEmployeeList[$key]);
     }
 }
示例#7
0
 /**
  * Set up method
  */
 protected function setUp()
 {
     $this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmCorePlugin/test/fixtures/ScreenDao.yml';
     TestDataService::truncateSpecificTables(array('SystemUser'));
     TestDataService::populate($this->fixture);
     $this->dao = new ScreenDao();
 }
 public function testBulkAssignLeaveEntitlements()
 {
     $this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmLeavePlugin/test/fixtures/LeaveEntitlement.yml';
     TestDataService::populate($this->fixture);
     $dao = new LeaveEntitlementDao();
     $limit = 5000;
     $empList = array();
     $employeeService = new EmployeeService();
     $employeeService->setEmployeeDao(new EmployeeDao());
     for ($i = 0; $i < $limit; $i++) {
         $employee = new Employee();
         $employee->setFirstName($i);
         $employee = $employeeService->saveEmployee($employee);
         array_push($empList, $employee->getEmpNumber());
     }
     $start_time = microtime(true);
     $leaveEntitlement = new LeaveEntitlement();
     $leaveEntitlement->setLeaveTypeId(1);
     $leaveEntitlement->setCreditedDate(date('Y-m-d'));
     $leaveEntitlement->setEntitlementType(LeaveEntitlement::ENTITLEMENT_TYPE_ADD);
     $leaveEntitlement->setDeleted(0);
     $leaveEntitlement->setNoOfDays(2);
     $leaveEntitlement->setFromDate('2012-01-01');
     $leaveEntitlement->setToDate('2012-08-01');
     $result = $dao->bulkAssignLeaveEntitlements($empList, $leaveEntitlement);
     $deference = microtime(true) - $start_time;
     $this->assertEquals(count($empList), $result, "Time Deference - " . $deference);
     echo "Add Entitlement 5000 Time " . $deference;
 }
 protected function setUp()
 {
     $this->dao = new OpenIdProviderDao();
     $fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmOpenidAuthenticationPlugin/test/fixtures/openiduser.yml';
     TestDataService::truncateTables(array('OpenidProvider'));
     TestDataService::populate($fixture);
 }
 protected function setUp()
 {
     $this->reportableService = new ReportableService();
     TestDataService::truncateTables(array('Report', 'ReportGroup'));
     TestDataService::populate(sfConfig::get('sf_plugins_dir') . '/orangehrmCorePlugin/test/fixtures/ReportableService.yml');
     $this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmCorePlugin/test/fixtures/ReportableService.yml';
 }
示例#11
0
 /**
  * Set up method
  */
 protected function setUp()
 {
     TestDataService::truncateTables(array('ModuleDefaultPage', 'HomePage', 'UserRole', 'Module'));
     $this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmCorePlugin/test/fixtures/HomePageDao.yml';
     $this->testData = sfYaml::load($this->fixture);
     TestDataService::populate($this->fixture);
     $this->homePageDao = new HomePageDao();
 }
 protected function setUp()
 {
     $this->leavePeriodService = new LeavePeriodService();
     $leaveEntitlementService = new LeaveEntitlementService();
     $leaveEntitlementService->setLeaveEntitlementStrategy(new FIFOEntitlementConsumptionStrategy());
     $this->leavePeriodService->setLeaveEntitlementService($leaveEntitlementService);
     TestDataService::truncateTables(array('LeavePeriodHistory'));
 }
示例#13
0
 /**
  * @group orangehrmAttendancePlugin
  */
 public function testSavePunchRecordForExistingPunchRecord()
 {
     $attendanceRecord = TestDataService::fetchObject('AttendanceRecord', 1);
     $attendanceRecord->setState("PUNCHED IN");
     $saveRecord = $this->attendanceDao->savePunchRecord($attendanceRecord);
     $this->assertEquals($saveRecord->getState(), 'PUNCHED IN');
     $this->assertEquals($saveRecord->getPunchInTimeOffset(), 'Asia/Calcutta');
 }
示例#14
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->dao = new CountryDao();
     $this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmAdminPlugin/test/fixtures/CountryDao.yml';
     $sampleData = sfYaml::load($this->fixture);
     $this->sampleCountries = $sampleData['Country'];
     TestDataService::populate($this->fixture);
 }
 protected function validateResultRecords($originalQuery, $expectedQuery, $service, $method)
 {
     $resultQuery = self::$baseService->decorateQuery($service, $method, $originalQuery);
     $expectedRecords = TestDataService::getRecords($expectedQuery);
     $resultRecords = TestDataService::getRecords($resultQuery);
     $this->assertEquals($expectedRecords, $resultRecords);
     $this->resultRecords = $resultRecords;
 }
 public function testGtJobCategoryById()
 {
     $jobCatList = TestDataService::loadObjectList('JobCategory', $this->fixture, 'JobCategory');
     $jobCatDao = $this->getMock('JobCategoryDao');
     $jobCatDao->expects($this->once())->method('getJobCategoryById')->with(1)->will($this->returnValue($jobCatList[0]));
     $this->jobCatService->setJobCategoryDao($jobCatDao);
     $result = $this->jobCatService->getJobCategoryById(1);
     $this->assertEquals($result, $jobCatList[0]);
 }
 public function testAddSubunit()
 {
     $subunitList = TestDataService::loadObjectList('Subunit', $this->fixture, 'Subunit');
     $subunit = $subunitList[2];
     $parentSubunit = new Subunit();
     $parentSubunit->setName("New Department");
     $this->assertTrue($this->companyStructureDao->addSubunit($parentSubunit, $subunit));
     $this->assertNotNull($parentSubunit->getId());
 }
 public function testGetLocationList()
 {
     $locationList = TestDataService::loadObjectList('Location', $this->fixture, 'Location');
     $locationDao = $this->getMock('LocationDao');
     $locationDao->expects($this->once())->method('getLocationList')->will($this->returnValue($locationList));
     $this->locationService->setLocationDao($locationDao);
     $result = $this->locationService->getLocationList();
     $this->assertEquals($result, $locationList);
 }
 public function testEditTerminationReason()
 {
     $terminationReason = TestDataService::fetchObject('TerminationReason', 3);
     $terminationReason->setName('2011 Layed off');
     $this->terminationReasonDao->saveTerminationReason($terminationReason);
     $savedTerminationReason = TestDataService::fetchLastInsertedRecord('TerminationReason', 'id');
     $this->assertTrue($savedTerminationReason instanceof TerminationReason);
     $this->assertEquals('2011 Layed off', $savedTerminationReason->getName());
 }
示例#20
0
 public function testGetAllCustomers()
 {
     $customerList = TestDataService::loadObjectList('Customer', $this->fixture, 'Customer');
     $customerDao = $this->getMock('CustomerDao');
     $customerDao->expects($this->once())->method('getAllCustomers')->with(false)->will($this->returnValue($customerList));
     $this->customerService->setCustomerDao($customerDao);
     $result = $this->customerService->getAllCustomers(false);
     $this->assertEquals($result, $customerList);
 }
示例#21
0
 /**
  * Testing getValue()
  */
 public function testGetValue()
 {
     // Test values in fixtures.yml
     $fixtureObjects = TestDataService::loadObjectList('Config', $this->fixture, 'Config');
     foreach ($fixtureObjects as $config) {
         $value = $this->configDao->getValue($config->key);
         $this->assertEquals($config->value, $value);
     }
 }
 public function testUpdateWorkShift()
 {
     $workShiftList = TestDataService::loadObjectList('WorkShift', $this->fixture, 'WorkShift');
     $workShiftDao = $this->getMock('WorkShiftDao');
     $workShiftDao->expects($this->once())->method('updateWorkShift')->with($workShiftList[0])->will($this->returnValue(true));
     $this->workShiftService->setWorkShiftDao($workShiftDao);
     $result = $this->workShiftService->updateWorkShift($workShiftList[0]);
     $this->assertTrue($result);
 }
 public function testGetEmploymentStatusById()
 {
     $empStatusList = TestDataService::loadObjectList('EmploymentStatus', $this->fixture, 'EmploymentStatus');
     $empStatusDao = $this->getMock('EmploymentStatusDao');
     $empStatusDao->expects($this->once())->method('getEmploymentStatusById')->with(1)->will($this->returnValue($empStatusList[0]));
     $this->empStatService->setEmploymentStatusDao($empStatusDao);
     $result = $this->empStatService->getEmploymentStatusById(1);
     $this->assertEquals($result, $empStatusList[0]);
 }
 public function testGetNationalityById()
 {
     $nationalityList = TestDataService::loadObjectList('Nationality', $this->fixture, 'Nationality');
     $nationalityDao = $this->getMock('NationalityDao');
     $nationalityDao->expects($this->once())->method('getNationalityById')->with(1)->will($this->returnValue($nationalityList[0]));
     $this->nationalityService->setNationalityDao($nationalityDao);
     $result = $this->nationalityService->getNationalityById(1);
     $this->assertEquals($result, $nationalityList[0]);
 }
示例#25
0
 public function testEditLanguage()
 {
     $language = TestDataService::fetchObject('Language', 3);
     $language->setName('Canadian French');
     $this->languageDao->saveLanguage($language);
     $savedLanguage = TestDataService::fetchLastInsertedRecord('Language', 'id');
     $this->assertTrue($savedLanguage instanceof Language);
     $this->assertEquals('Canadian French', $savedLanguage->getName());
 }
 public function testGetJobTitleById()
 {
     $jobTitleList = TestDataService::loadObjectList('JobTitle', $this->fixture, 'JobTitle');
     $jobTitleDao = $this->getMock('JobTitleDao');
     $jobTitleDao->expects($this->once())->method('getJobTitleById')->with(1)->will($this->returnValue($jobTitleList[0]));
     $this->JobTitleService->setJobTitleDao($jobTitleDao);
     $result = $this->JobTitleService->getJobTitleById(1);
     $this->assertEquals($jobTitleList[0], $result);
 }
 public function testGetMembershipById()
 {
     $membershipList = TestDataService::loadObjectList('Membership', $this->fixture, 'Membership');
     $membershipDao = $this->getMock('MembershipDao');
     $membershipDao->expects($this->once())->method('getMembershipById')->with(1)->will($this->returnValue($membershipList[0]));
     $this->membershipService->setMembershipDao($membershipDao);
     $result = $this->membershipService->getMembershipById(1);
     $this->assertEquals($result, $membershipList[0]);
 }
 public function testEditReportingMethod()
 {
     $reportingMethod = TestDataService::fetchObject('ReportingMethod', 3);
     $reportingMethod->setName('Finance HR');
     $this->reportingMethodDao->saveReportingMethod($reportingMethod);
     $savedReportingMethod = TestDataService::fetchLastInsertedRecord('ReportingMethod', 'id');
     $this->assertTrue($savedReportingMethod instanceof ReportingMethod);
     $this->assertEquals('Finance HR', $savedReportingMethod->getName());
 }
示例#29
0
 public function testEditEducation()
 {
     $education = TestDataService::fetchObject('Education', 3);
     $education->setName('MSc New');
     $this->educationDao->saveEducation($education);
     $savedEducation = TestDataService::fetchLastInsertedRecord('Education', 'id');
     $this->assertTrue($savedEducation instanceof Education);
     $this->assertEquals('MSc New', $savedEducation->getName());
 }
示例#30
0
 public function testEditLicense()
 {
     $license = TestDataService::fetchObject('License', 3);
     $license->setName('Moon Pilot');
     $this->licenseDao->saveLicense($license);
     $savedLicense = TestDataService::fetchLastInsertedRecord('License', 'id');
     $this->assertTrue($savedLicense instanceof License);
     $this->assertEquals('Moon Pilot', $savedLicense->getName());
 }