Exemple #1
0
 /**
  * Add or Save TimesheetActionLog
  * @param TimesheetActionLog $timesheetActionLog
  * @return $timesheetActionLog
  */
 public function saveTimesheetActionLog(TimesheetActionLog $timesheetActionLog)
 {
     try {
         if ($timesheetActionLog->getTimesheetActionLogId() == '') {
             $idGenService = new IDGeneratorService();
             $idGenService->setEntity($timesheetActionLog);
             $timesheetActionLog->setTimesheetActionLogId($idGenService->getNextID());
         }
         $timesheetActionLog->save();
         return $timesheetActionLog;
     } catch (Exception $ex) {
         throw new DaoException($ex->getMessage());
     }
 }
 /**
  * Testing saveTimesheetActionLog mthod for newly made timesheet action logs
  */
 public function testSaveTimesheetActionLogWithNewTimesheetActionLog()
 {
     TestDataService::truncateSpecificTables(array('TimesheetActionLog'), true);
     $timesheetActionLog = new TimesheetActionLog();
     $timesheetActionLog->setTimesheetId(1);
     $timesheetActionLog->setDateTime('2011-04-23');
     $timesheetActionLog->setComment('New Timesheet Item');
     $timesheetActionLog->setAction('ACCEPTED');
     $timesheetActionLog->setPerformedBy('3');
     $savedNewTimesheetActionLog = $this->timesheetDao->saveTimesheetActionLog($timesheetActionLog);
     $this->assertTrue($savedNewTimesheetActionLog instanceof TimesheetActionLog);
     $this->assertEquals('001', $savedNewTimesheetActionLog->getTimesheetActionLogId());
     $this->assertEquals($timesheetActionLog->getTimesheetId(), $savedNewTimesheetActionLog->getTimesheetId());
     $this->assertEquals($timesheetActionLog->getDateTime(), $savedNewTimesheetActionLog->getDateTime());
     $this->assertEquals($timesheetActionLog->getComment(), $savedNewTimesheetActionLog->getComment());
     $this->assertEquals($timesheetActionLog->getAction(), $savedNewTimesheetActionLog->getAction());
     $this->assertEquals($timesheetActionLog->getPerformedBy(), $savedNewTimesheetActionLog->getPerformedBy());
 }