本文整理汇总了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");
}
示例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;
}
示例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]);
}
示例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);
}