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