date_default_timezone_set('UTC'); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); if (session_status() === PHP_SESSION_NONE) { session_start(); } session_regenerate_id(TRUE); session_destroy(); session_start(); // Must get tA_id for the lesson to be tested. require_once "../test_lesson_include.php"; $_SESSION['tA_S_ID'] = "zxcvb"; $_SESSION['tA_StartRec'] = 1; $class_instance = new AssignmentsClass(); $class_instance->delRowsByStudentId($_SESSION['tA_S_ID']); $target_assignment_name = 'gA_clockwise_counterclockwise'; // $secondary_assignment_name = 'gA_left_right_blocks';. $lessons_to_ta = array(array('ga' => 'gA_left_right_blocks', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_typing_lessons_cl', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_spelling', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_horizontal_vertical_diagonal', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_one_digit_addition_vertical_clues', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_clockwise_counterclockwise', 'tA_PostDateIncrement' => 2)); foreach ($lessons_to_ta as $v1) { $_SESSION['tG_AssignmentName'] = $v1["ga"]; $_SESSION['tA_PostDateIncrement'] = $v1['tA_PostDateIncrement']; $_SESSION['tA_Post_date'] = round(microtime(TRUE), 3, PHP_ROUND_HALF_EVEN) + $_SESSION['tA_PostDateIncrement']; $result = $class_instance->insertRecord($_SESSION); } $result = $class_instance->getSpecificStudentAssignmentFromDbAsArray($_SESSION['tA_S_ID'], $target_assignment_name, $_SESSION['tA_StartRec']); // Echo $_SESSION['tG_AssignmentName'];. $_SESSION['tA_id'] = $result['tA_id']; // Echo $_SESSION['tA_id']; // Load the lesson to test. require 'clockwise_counterclockwise.php';
/** * Test cAssignmentGetNextLesson(). */ public function testcAssignmentGetNextLesson() { /* Tests cAssignment_get_next_lesson.php Does not show up on missing tests because cAssignments is not in assignments.class Function cAssignments_get_next_lesson is called from javascript. */ // Next reset myArray to origninal values. $this->resetMyArray(); // Add a new row to delete. $ac_class_instance = new AssignmentsClass(); $this->assertTrue(isset($ac_class_instance)); $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']); $temp_student_id = 'abcdefg'; $this->myArray['tA_S_ID'] = $temp_student_id; // Set to a different value. $ac_class_instance->delRowsByStudentId($temp_student_id); // Insure no previous lessons for this student. $result = $ac_class_instance->insertRecord($this->myArray); $this->assertTrue($result == 1); $_SESSION['tA_S_ID'] = $temp_student_id; $ac_class_instance->delRowsByStudentId('abcdefg'); }