Пример #1
0
$tA_LastModifiedDateTime = time();
$value_array['tA_Post_date'] = $tA_LastModifiedDateTime + $post_date_time;
$string = "\n" . __LINE__ . '$tA_LastModifiedDateTime = ' . $tA_LastModifiedDateTime;
fwrite($log_file, $string);
$v = var_export($value_array, TRUE);
$string = "\n" . __LINE__ . '$value_array["tA_Post_date"] = ' . $v;
fwrite($log_file, $string);
$value_array["tA_RepsTowardM"] = $tA_RepsTowardM;
// Set at lines 75-85
// $value_array['tA_ErrorsMade'] set at line 145
$value_array['tA_LastModifiedDateTime'] = $tA_LastModifiedDateTime;
$v = var_export($value_array, TRUE);
$string = __LINE__ . ' $value_array = ' . "{$v}\n\n";
fwrite($log_file, $string);
$classInstance = new AssignmentsClass();
$returnedValue = $classInstance->updateFields($value_array, $where_array);
$string = __LINE__ . ' $returnedValue = ' . $returnedValue . "\n\n";
fwrite($log_file, $string);
$string = __LINE__ . ' gettype($returnedValue) = ' . gettype($returnedValue) . "\n\n";
fwrite($log_file, $string);
// Returns count of rows affected.
if ($returnedValue !== 1) {
    // Serious Error..
    $string = "\n" . __LINE__ . " update_tA_TC.php failed to record data in tAssignments.";
    fwrite($log_file, $string);
}
/**
 * Clone and instert a lesson incremented by one in some lessons.
 *
 * Applies to Spelling or typing or some types of math with many parameters.
 */
Пример #2
0
 /**
  * Test test "normalizePercentTimeTo100Percent()" in Assignments.class.inc.
  */
 public function testupdateFields()
 {
     $this->resetMyArray();
     // Reset myArray to origninal values.
     $ac_class_instance = new AssignmentsClass();
     $this->assertTrue(isset($ac_class_instance));
     $temp_student_id = 'bcdefgh';
     // Insure no previous lessons for this student.
     $result = $ac_class_instance->delRowsByStudentId($temp_student_id);
     $this->assertTrue($result === 0);
     // "No rows should be deleted if all previous methods have cleaned up.");.
     $this->myArray['tA_S_ID'] = $temp_student_id;
     $result = $ac_class_instance->getCurrentStudentAssignmentsInAnArray($this->myArray['tA_S_ID']);
     $this->assertTrue(count($result) === 0, 'Should return 0 because no assignments have been added.');
     $result = $ac_class_instance->insertRecord($this->myArray);
     $this->assertTrue($result === 1, '1 if insertion succeeded.');
     $results = $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']);
     $this->assertTrue($results === 1, 'Should be 1.');
     // Now create one row with a significant post date.
     $this->myArray['tA_Post_date'] = time() + 1000000000;
     $result = $ac_class_instance->insertRecord($this->myArray);
     $this->assertTrue($result === 1, '1 if insertion succeeded.');
     $where_array = array('tA_S_ID' => 'bcdefgh', 'tA_ErrorsMade' => '4');
     $value_array = array('tA_ErrorsMade' => '2', 'tA_StartRec' => '25');
     $result = $ac_class_instance->updateFields($value_array, $where_array);
     $this->assertTrue($result === 1);
     // Get the row and check the results.
     $result2 = $ac_class_instance->getNewestDbEntry('bcdefgh');
     $this->assertTrue($result2['tA_StartRec'] === '25');
     $this->assertTrue($result2['tA_ErrorsMade'] === '2');
     $where_array = array('tA_S_ID' => 'bcdefgh', 'tA_ErrorsMade' => '2');
     $value_array = array('tA_ErrorsMade' => '6', 'tA_StartRec' => '27');
     $result = $ac_class_instance->updateFields($value_array, $where_array);
     $result2 = $ac_class_instance->getNewestDbEntry('bcdefgh');
     $this->assertTrue($result2['tA_StartRec'] === '27');
     $this->assertTrue($result2['tA_ErrorsMade'] === '6');
     // Now delete the rows.
     $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']);
     $ac_class_instance->delRowsByStudentId('bcdefgh');
 }