Exemple #1
0
 public function checkin($idmNo)
 {
     $cmapper = new CheckinLogMapper(self::$pdo);
     $imapper = new IDmMapper(self::$pdo);
     // 受け取ったidmNoがIDmsに存在するかチェック
     // 存在しなければあたらしくidmを登録する
     if (!$imapper->hasIDmNo($idmNo)) {
         $idm = new IDm();
         $idm->idm_no = $idmNo;
         $imapper->insert($idm);
     } else {
         $idm = $imapper->findByIDm($idmNo);
     }
     // Logを追加
     $log = new CheckinLog();
     $log->idm_id = $idm->idm_id;
     $cmapper->insert($log);
     return $log;
 }
 public function testModCheckinTime()
 {
     $cmapper = new CheckinLogMapper(self::$pdo);
     $log = getLogInstance();
     $cmapper->insert($log);
     $log->checkin_time = date('Y-m-d H:i:s');
     $cmapper->changeCheckinTime($log);
     $newLog = $cmapper->find($log->checkin_id);
     $this->assertEquals($newLog->checkin_time, $log->checkin_time);
 }
 public function testUserByDate()
 {
     $cmapper = new CheckinLogMapper(self::$pdo);
     $dbfacade = DBFacade::I(self::$pdo);
     $log = getLogInstance();
     $cmapper->insert($log);
     $newLogs = $dbfacade->findUserByDate(date('Y-m-d'));
     // echo 'log: ';
     // var_dump( $log);
     // echo 'new log: ';
     // var_dump($newLogs);
     // echo 'date: '. $newLogs[0]['checkin_time'];
     $this->assertEquals($log->checkin_time, $newLogs[0]['checkin_time']);
 }