本文整理匯總了PHP中TestDataService::fetchLastInsertedRecords方法的典型用法代碼示例。如果您正苦於以下問題:PHP TestDataService::fetchLastInsertedRecords方法的具體用法?PHP TestDataService::fetchLastInsertedRecords怎麽用?PHP TestDataService::fetchLastInsertedRecords使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TestDataService
的用法示例。
在下文中一共展示了TestDataService::fetchLastInsertedRecords方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSaveLeaveTypeCheckSavedType
public function testSaveLeaveTypeCheckSavedType()
{
TestDataService::truncateTables(array('LeaveType'));
$this->leaveTypeDao->saveLeaveType($this->_getLeaveTypeObjectWithValues());
$savedLeaveTypes = TestDataService::fetchLastInsertedRecords('LeaveType', 1);
$this->assertEquals('LTY001', $savedLeaveTypes[0]->getLeaveTypeId());
$this->assertEquals('Special', $savedLeaveTypes[0]->getLeaveTypeName());
}
示例2: testGetEmployeePassport2
/**
* Test saving getEmployeePassport returns Collection
*/
public function testGetEmployeePassport2()
{
$empPassports = TestDataService::fetchLastInsertedRecords('EmployeeImmigrationRecord', 2);
foreach ($empPassports as $passport) {
$collection = $this->employeeDao->getEmployeeImmigrationRecords($passport->getEmpNumber());
$this->assertTrue($collection instanceof Doctrine_Collection);
}
}
示例3: xtestModifyOverlapLeaveRequest
public function xtestModifyOverlapLeaveRequest()
{
/* Preparing required data */
$leaveRequest = new LeaveRequest();
$leaveRequest->setLeavePeriodId(1);
$leaveRequest->setLeaveTypeId('LTY001');
$leaveRequest->setLeaveTypeName('Casual');
$leaveRequest->setDateApplied('2010-12-01');
$leaveRequest->setEmpNumber(1);
$leave[0] = new Leave();
$leave[0]->setLeaveLengthHours(8);
$leave[0]->setLeaveLengthDays(1);
$leave[0]->setLeaveDate('2010-12-30');
$leave[0]->setLeaveStatus(1);
$leave[1] = new Leave();
$leave[1]->setLeaveLengthHours(8);
$leave[1]->setLeaveLengthDays(1);
$leave[1]->setLeaveDate('2010-12-31');
$leave[1]->setLeaveStatus(1);
$leave[2] = new Leave();
$leave[2]->setLeaveLengthHours(8);
$leave[2]->setLeaveLengthDays(1);
$leave[2]->setLeaveDate('2011-01-01');
$leave[2]->setLeaveStatus(1);
$leave[3] = new Leave();
$leave[3]->setLeaveLengthHours(8);
$leave[3]->setLeaveLengthDays(1);
$leave[3]->setLeaveDate('2011-01-02');
$leave[3]->setLeaveStatus(1);
$leavePeriod = TestDataService::fetchObject('LeavePeriod', 1);
/* Executing tests */
/* At use, modifyOverlapLeaveRequest() is called after calling
* saveLeaveRequest()
*/
$leaveRequest = $this->leaveRequestDao->saveLeaveRequest($leaveRequest, $leave);
$this->assertTrue($leaveRequest instanceof LeaveRequest);
$this->assertTrue($this->leaveRequestDao->modifyOverlapLeaveRequest($leaveRequest, $leave, $leavePeriod));
$leaveRequestList = TestDataService::fetchLastInsertedRecords('LeaveRequest', 2);
$this->assertEquals(21, $leaveRequestList[0]->getLeaveRequestId());
$this->assertEquals('LTY001', $leaveRequestList[0]->getLeaveTypeId());
$this->assertEquals('Casual', $leaveRequestList[0]->getLeaveTypeName());
$this->assertEquals('2010-12-01', $leaveRequestList[0]->getDateApplied());
$this->assertEquals(1, $leaveRequestList[0]->getEmpNumber());
$this->assertEquals(22, $leaveRequestList[1]->getLeaveRequestId());
$this->assertEquals('LTY001', $leaveRequestList[1]->getLeaveTypeId());
$this->assertEquals('Casual', $leaveRequestList[1]->getLeaveTypeName());
$this->assertEquals('2010-12-01', $leaveRequestList[1]->getDateApplied());
$this->assertEquals(1, $leaveRequestList[1]->getEmpNumber());
$leaveList = TestDataService::fetchLastInsertedRecords('Leave', 4);
$this->assertEquals(36, $leaveList[0]->getId());
$this->assertEquals(8, $leaveList[0]->getLengthHours());
$this->assertEquals(1, $leaveList[0]->getLengthDays());
$this->assertEquals(21, $leaveList[0]->getLeaveRequestId());
$this->assertEquals('LTY001', $leaveList[0]->getLeaveTypeId());
$this->assertEquals(1, $leaveList[0]->getEmpNumber());
$this->assertEquals('2010-12-30', $leaveList[0]->getDate());
$this->assertEquals(1, $leaveList[0]->getStatus());
$this->assertEquals(37, $leaveList[1]->getId());
$this->assertEquals(8, $leaveList[1]->getLengthHours());
$this->assertEquals(1, $leaveList[1]->getLengthDays());
$this->assertEquals(21, $leaveList[1]->getLeaveRequestId());
$this->assertEquals('LTY001', $leaveList[1]->getLeaveTypeId());
$this->assertEquals(1, $leaveList[1]->getEmpNumber());
$this->assertEquals('2010-12-31', $leaveList[1]->getDate());
$this->assertEquals(1, $leaveList[1]->getStatus());
$this->assertEquals(38, $leaveList[2]->getId());
$this->assertEquals(8, $leaveList[2]->getLengthHours());
$this->assertEquals(1, $leaveList[2]->getLengthDays());
$this->assertEquals(22, $leaveList[2]->getLeaveRequestId());
$this->assertEquals('LTY001', $leaveList[2]->getLeaveTypeId());
$this->assertEquals(1, $leaveList[2]->getEmpNumber());
$this->assertEquals('2011-01-01', $leaveList[2]->getDate());
$this->assertEquals(1, $leaveList[2]->getStatus());
$this->assertEquals(39, $leaveList[3]->getId());
$this->assertEquals(8, $leaveList[3]->getLengthHours());
$this->assertEquals(1, $leaveList[3]->getLengthDays());
$this->assertEquals(22, $leaveList[3]->getLeaveRequestId());
$this->assertEquals('LTY001', $leaveList[3]->getLeaveTypeId());
$this->assertEquals(1, $leaveList[3]->getEmpNumber());
$this->assertEquals('2011-01-02', $leaveList[3]->getDate());
$this->assertEquals(1, $leaveList[3]->getStatus());
}
示例4: testSaveLeaveTypeDuplicateKey
/**
* @expectedException DaoException
*/
public function testSaveLeaveTypeDuplicateKey()
{
$this->dao->saveLeaveType($this->_getLeaveTypeObjectWithValues());
$savedLeaveTypes = TestDataService::fetchLastInsertedRecords('LeaveType', 1);
$savedId = $savedLeaveTypes[0]->getId();
/* Following should throw an exception for */
$leaveType = $this->_getLeaveTypeObjectWithValues();
$leaveType->setId($savedId);
$this->dao->saveLeaveType($leaveType);
}