當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TestDataService::getRecords方法代碼示例

本文整理匯總了PHP中TestDataService::getRecords方法的典型用法代碼示例。如果您正苦於以下問題:PHP TestDataService::getRecords方法的具體用法?PHP TestDataService::getRecords怎麽用?PHP TestDataService::getRecords使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TestDataService的用法示例。


在下文中一共展示了TestDataService::getRecords方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCalculateDaysInTheTimesheetPeriod

 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");
 }
開發者ID:lahirwisada,項目名稱:orangehrm,代碼行數:26,代碼來源:WeeklyTimesheetPeriodTest.php

示例2: validateResultRecords

 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;
 }
開發者ID:lahirwisada,項目名稱:orangehrm,代碼行數:8,代碼來源:BaseServiceDataTest.php

示例3: testCalculateDaysInTheTimesheetPeriod

 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';
     $dates = $this->monthlyTimesheetPeriod->calculateDaysInTheTimesheetPeriod($currentDate, $xmlString);
     $this->assertEquals("2011-04-13", $dates[0]);
     $this->assertEquals("2011-05-12", end($dates));
     $this->assertEquals("2011-04-18", $dates[5]);
     $dates = $this->monthlyTimesheetPeriod->calculateDaysInTheTimesheetPeriod("2011-02-18", $xmlString);
     $this->assertEquals("2011-02-13", $dates[0]);
     $this->assertEquals("2011-03-12", end($dates));
     $this->assertEquals("2011-02-23", $dates[10]);
     $dates = $this->monthlyTimesheetPeriod->calculateDaysInTheTimesheetPeriod("2012-02-18", $xmlString);
     $this->assertEquals("2012-02-13", $dates[0]);
     $this->assertEquals("2012-03-12", end($dates));
     $this->assertEquals("2012-02-28", $dates[15]);
     $dates = $this->monthlyTimesheetPeriod->calculateDaysInTheTimesheetPeriod("2012-12-31", $xmlString);
     $this->assertEquals("2012-12-13", $dates[0]);
     $this->assertEquals("2013-01-12", end($dates));
     $this->assertEquals("2013-01-02", $dates[20]);
 }
開發者ID:THM068,項目名稱:orangehrm,代碼行數:24,代碼來源:MonthlyTimesheetPeriodTest.php

示例4: testGetTimesheetHeading

 public function testGetTimesheetHeading()
 {
     $key = 'timesheet_period_and_start_date';
     // Note: fetchObject fails due to primary key 'key' being a reserved word.
     //$xmlString = TestDataService::fetchObject('Config', $key);
     $xmlString = TestDataService::getRecords("SELECT value from hs_hr_config WHERE `key` = '" . $key . "'");
     $value = $xmlString[0]['value'];
     $timesheetPeriodDaoMock = $this->getMock('TimesheetPeriodDao', array('getDefinedTimesheetPeriod'));
     $timesheetPeriodDaoMock->expects($this->once())->method('getDefinedTimesheetPeriod')->will($this->returnValue($value));
     $this->timesheetPeriodService->setTimesheetPeriodDao($timesheetPeriodDaoMock);
     $timesheetHeading = $this->timesheetPeriodService->getTimesheetHeading();
     $this->assertEquals("Week", (string) $timesheetHeading);
 }
開發者ID:lahirwisada,項目名稱:orangehrm,代碼行數:13,代碼來源:TimesheetPeriodServiceTest.php


注:本文中的TestDataService::getRecords方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。