示例#1
0
 /**
  * Test test "normalizePercentTimeTo100Percent()" in Assignments.class.inc
  *
  * A *description*, that can span multiple lines, to go _in-depth_ into the details of this element
  * and to provide some background information or textual references.
  *
  * @return void
  */
 public function testupdateTaStartRec()
 {
     // Objective: Create a db entry and then update it and test for
     // the update.
     $log_file = fopen("/var/www/html/jimfuqua/tutor/logs/testupdateTaStartRec.log", "w");
     // the lessons inserted do not have tA_PercentTime  error is in the insert
     //$v = var_export($studentAssignmentsArray, true);
     //$string = __LINE__.' $studentAssignmentsArray = '.$v."\n\n";
     //fwrite($log_file, $string)
     $this->testbuildArray();
     // reset myArray to origninal values.
     $this->myArray['tA_OriginalTimestamp'] = '0987654321';
     $this->myArray['tA_S_ID'] = 'x!@#$1112';
     $this->myArray['tA_StartRec'] = 22;
     $classInstance = new tutor\src\classes\AssignmentsClass();
     $result1 = $classInstance->insertRecord($this->myArray);
     $this->assertTrue($result1 === 1);
     $result2 = $classInstance->updateTaStartRec(44, $this->myArray['tA_S_ID'], $this->myArray['tA_OriginalTimestamp']);
     $string = __LINE__ . ' $result2 = ' . $result2 . "\n\n";
     fwrite($log_file, $string);
     $this->assertTrue($result2 === 1);
     // mysql_affected_rows
     // Get the row and check the results.
     $classInstance = new tutor\src\classes\AssignmentsClass();
     $result3 = $classInstance->getNewestDbEntry('x!@#$1112');
     $this->assertTrue($result3['tA_StartRec'] == '44');
     // Now delete the rows.
     $classInstance->delRowsByStudentId('x!@#$1112');
     $classInstance->delRowsByStudentId('!@#$1112');
     // Clean Up
     $classInstance->delRowsByStudentId($this->myArray['tA_S_ID']);
     $this->testbuildArray();
     // reset myArray to origninal values.
 }