public function testCreation() { $this->testbuildArray(); // reset myArray to origninal values. $classInstance = new tutor\src\CompletedClass(); $classInstance->recordData($this->myArray); $this->assertTrue(isset($classInstance)); return $classInstance; $this->assertTrue(FALSE); }
$tC_Param_array['tC_ServerTimeStarted'] = $_POST['tC_ServerTimeStarted']; $tC_Param_array['tC_ClientTimeStarted'] = $_POST['tC_ClientTimeStarted']; $tC_Param_array['tC_Time_client_processed_answer'] = $_POST['tC_Time_client_processed_answer']; $tC_Param_array['tC_Correct'] = $_POST['tC_Correct']; $tC_Param_array['tC_Question_and_Response'] = $_POST['tC_Question_and_Response']; $tC_Param_array['tC_More_data_about_response'] = $_POST['tC_More_data_about_response']; $v = var_export($tC_Param_array, TRUE); $string = __LINE__ . ' $tC_Param_array = ' . $v . "\n\n"; fwrite($log_file, $string); // Sender is not a field in tA and should not be in the query. // Sender is a good source of info to detect tampering with input data.; // $sender = $_POST['sender']; $classInstance = new tutor\src\CompletedClass(); // To tCompleted using the class method. // returns count of rows affected. $returnedValue = $classInstance->recordData($tC_Param_array); $string = __LINE__ . ' $returnedValue = ' . $returnedValue . "\n\n"; fwrite($log_file, $string); $string = __LINE__ . ' gettype($returnedValue) = ' . gettype($returnedValue) . "\n\n"; fwrite($log_file, $string); if ($returnedValue !== 1) { $string = "\n" . __LINE__ . " Serious Error. update_tA_TC.php failed to record data in tCompleted." . "\n"; // Serious Error. fwrite($log_file, $string); } // NOW ALTER tAssignments. unset($where_array); $where_array = array('tA_S_ID' => $_POST['tA_S_ID'], 'tA_id' => $_POST['tA_id']); $v = var_export($where_array, TRUE); $string = __LINE__ . ' $where_array = ' . "{$v}\n\n"; fwrite($log_file, $string);
// Trigger fatal error. $msg = "Session must have a tG_AssignmentName "; $msg .= "to record data to database."; trigger_error($msg, E_USER_ERROR); } else { $tC_gA = $_SESSION["tG_AssignmentName"]; } if (!isset($_SESSION["tA_StartRec"])) { // Trigger fatal error. $msg = "Session must have a tA_StartRec to record data to database."; trigger_error($msg, E_USER_ERROR); } else { $tA_StartRec = $_SESSION["tA_StartRec"]; } if (!isset($_POST['tC_ClientTimeStarted'])) { // Trigger fatal error. $msg = "Session must have a tC_ClientTimeStarted to record data to database."; trigger_error($msg, E_USER_ERROR); } else { $tC_ClientTimeStarted = $_POST['tC_ClientTimeStarted']; } if (!isset($_POST['tC_Correct'])) { // Trigger fatal error. trigger_error("Session must have a tC_Correct to record data to database.", E_USER_ERROR); } else { $tC_Correct = $_POST['tC_Correct']; } $classInstance = new tutor\src\CompletedClass(); $incoming_data = array("tC_Session" => session_id(), "tC_ServerTimeStarted" => $_SESSION["tC_ServerTimeStarted"], "tA_StudentName" => $_SESSION['tA_StudentName'], "tA_S_ID" => $_SESSION['tA_S_ID'], "tC_gA" => $_SESSION['tG_AssignmentName'], "tC_tGStartRec" => $_SESSION['tA_StartRec'], "tC_ClientTimeStarted" => $_POST['tC_ClientTimeStarted'], "tC_Time_client_processed_answer" => $_POST["tC_Time_client_processed_answer"], "tC_Correct" => $_POST['tC_Correct'], "tC_Question_and_Response" => $_POST["tC_Question_and_Response"], "tC_More_data_about_response" => $_POST["tC_More_data_about_response"]); $y = $classInstance->recordData($incoming_data); // to tCompleted using the class method.